Submission #16753784


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    string s;
    cin >> s;

    ll ans = 0;
    rep(i, s.size()) {
        int j = i;
        ll cnt = 0;
        while (j < s.size() - 1 && s[j] == '2' && s[j + 1] == '5') {
            cnt++;
            j += 2;
        }
        i = j;

        ans += cnt * (cnt + 1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User take000
Language C++ (GCC 9.2.1)
Score 100
Code Size 478 Byte
Status
Exec Time 11 ms
Memory 3680 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:2:37: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    2 | #define rep(i, n) for (int i = 0; i < n; ++i)
......
   11 |     rep(i, s.size()) {
      |         ~~~~~~~~~~~                  
./Main.cpp:11:5: note: in expansion of macro ‘rep’
   11 |     rep(i, s.size()) {
      |     ^~~
./Main.cpp:14:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   14 |         while (j < s.size() - 1 && s[j] == '2' && s[j + 1] == '5') {
      |                ~~^~~~~~~~~~~~~~

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
× 5
× 18
× 30
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
Subtask1 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 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 7 ms 3472 KB
subtask0_sample_02.txt 7 ms 3416 KB
subtask0_sample_03.txt 1 ms 3576 KB
subtask0_sample_04.txt 2 ms 3468 KB
subtask0_sample_05.txt 2 ms 3412 KB
subtask1_01.txt 2 ms 3588 KB
subtask1_02.txt 2 ms 3532 KB
subtask1_03.txt 2 ms 3520 KB
subtask1_04.txt 1 ms 3480 KB
subtask1_05.txt 2 ms 3476 KB
subtask1_06.txt 2 ms 3560 KB
subtask1_07.txt 2 ms 3468 KB
subtask1_08.txt 2 ms 3588 KB
subtask1_09.txt 2 ms 3484 KB
subtask1_10.txt 2 ms 3596 KB
subtask1_11.txt 2 ms 3600 KB
subtask1_12.txt 2 ms 3588 KB
subtask1_13.txt 2 ms 3496 KB
subtask2_01.txt 7 ms 3644 KB
subtask2_02.txt 8 ms 3680 KB
subtask2_03.txt 10 ms 3600 KB
subtask2_04.txt 6 ms 3640 KB
subtask2_05.txt 9 ms 3668 KB
subtask2_06.txt 6 ms 3600 KB
subtask2_07.txt 4 ms 3644 KB
subtask2_08.txt 11 ms 3664 KB
subtask2_09.txt 2 ms 3560 KB
subtask2_10.txt 2 ms 3492 KB
subtask2_11.txt 2 ms 3440 KB
subtask2_12.txt 2 ms 3624 KB