Submission #14803001


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S; cin >> S;
    int ans = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i]!='2'||S[i+1]!='5')continue;
        int a = i;
        while(i+3<S.size()&&S[i+2]=='2'&&S[i+3]=='5')i += 2;
        ans +=((i-a)/2 + 1)*((i-a)/2 + 2)/2;
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User Sophie1234
Language C++ (GCC 9.2.1)
Score 30
Code Size 372 Byte
Status
Exec Time 11 ms
Memory 3724 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:6:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    6 |     for(int i = 0; i < S.size(); i++){
      |                    ~~^~~~~~~~~~
./Main.cpp:9:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    9 |         while(i+3<S.size()&&S[i+2]=='2'&&S[i+3]=='5')i += 2;
      |               ~~~^~~~~~~~~

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
Subtask1 30 / 30 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
All 0 / 70 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 11 ms 3468 KB
subtask0_sample_02.txt 2 ms 3504 KB
subtask0_sample_03.txt 2 ms 3572 KB
subtask0_sample_04.txt 3 ms 3476 KB
subtask0_sample_05.txt 2 ms 3472 KB
subtask1_01.txt 2 ms 3532 KB
subtask1_02.txt 2 ms 3600 KB
subtask1_03.txt 2 ms 3604 KB
subtask1_04.txt 2 ms 3436 KB
subtask1_05.txt 3 ms 3600 KB
subtask1_06.txt 2 ms 3508 KB
subtask1_07.txt 2 ms 3488 KB
subtask1_08.txt 5 ms 3432 KB
subtask1_09.txt 2 ms 3428 KB
subtask1_10.txt 2 ms 3528 KB
subtask1_11.txt 2 ms 3588 KB
subtask1_12.txt 2 ms 3600 KB
subtask1_13.txt 2 ms 3360 KB
subtask2_01.txt 9 ms 3720 KB
subtask2_02.txt 9 ms 3568 KB
subtask2_03.txt 9 ms 3604 KB
subtask2_04.txt 7 ms 3724 KB
subtask2_05.txt 6 ms 3640 KB
subtask2_06.txt 11 ms 3640 KB
subtask2_07.txt 6 ms 3620 KB
subtask2_08.txt 7 ms 3716 KB
subtask2_09.txt 2 ms 3448 KB
subtask2_10.txt 2 ms 3452 KB
subtask2_11.txt 2 ms 3452 KB
subtask2_12.txt 2 ms 3560 KB