Submission #15575301


Source Code Expand

Copy
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> cnt;
    int tmp_cnt = 0;
    rep(i, n) {
        if (i < n -1 && s[i] == '2' && s[i+1] == '5') {
            ++tmp_cnt;
            ++i;
        }
        else {
            if (tmp_cnt != 0) {
                cnt.push_back(tmp_cnt);
            }
            tmp_cnt = 0;
        }
    }
    if (tmp_cnt != 0) {
        cnt.push_back(tmp_cnt);
    }
    ll ans = 0;
    for (auto c : cnt) {
        //cout << c << endl;
        ans += (1+(ll)c)*(ll)c/2;
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User tatata1031
Language C++ (GCC 9.2.1)
Score 100
Code Size 952 Byte
Status
Exec Time 9 ms
Memory 3748 KB

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 70 / 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 6 ms 3472 KB
subtask0_sample_02.txt 2 ms 3476 KB
subtask0_sample_03.txt 2 ms 3576 KB
subtask0_sample_04.txt 2 ms 3472 KB
subtask0_sample_05.txt 2 ms 3612 KB
subtask1_01.txt 2 ms 3560 KB
subtask1_02.txt 2 ms 3564 KB
subtask1_03.txt 2 ms 3588 KB
subtask1_04.txt 2 ms 3428 KB
subtask1_05.txt 2 ms 3644 KB
subtask1_06.txt 2 ms 3608 KB
subtask1_07.txt 2 ms 3608 KB
subtask1_08.txt 2 ms 3608 KB
subtask1_09.txt 2 ms 3592 KB
subtask1_10.txt 2 ms 3412 KB
subtask1_11.txt 2 ms 3600 KB
subtask1_12.txt 2 ms 3592 KB
subtask1_13.txt 2 ms 3616 KB
subtask2_01.txt 5 ms 3708 KB
subtask2_02.txt 5 ms 3748 KB
subtask2_03.txt 5 ms 3720 KB
subtask2_04.txt 4 ms 3716 KB
subtask2_05.txt 8 ms 3736 KB
subtask2_06.txt 6 ms 3736 KB
subtask2_07.txt 9 ms 3728 KB
subtask2_08.txt 5 ms 3748 KB
subtask2_09.txt 2 ms 3624 KB
subtask2_10.txt 2 ms 3604 KB
subtask2_11.txt 2 ms 3628 KB
subtask2_12.txt 2 ms 3508 KB