Submission #15575682


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	string s;
	cin >> s;
	
	int n = (int)s.size();
	ll cnt = 0;
	ll ans = 0LL;
	
	for(int i = 0; i < n - 1; ++i) {
		if( s.substr(i, 2) == "25" ) {
			cnt++;
			i++;
		} else {
			ans += cnt * (cnt + 1) / 2;
			cnt = 0;
		}
	}
	
	ans += cnt * (cnt + 1) / 2;
	
	cout << ans << endl;
	
	return 0;
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User orieka
Language C++ (GCC 9.2.1)
Score 100
Code Size 698 Byte
Status
Exec Time 12 ms
Memory 3764 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 3492 KB
subtask0_sample_02.txt 3 ms 3480 KB
subtask0_sample_03.txt 3 ms 3556 KB
subtask0_sample_04.txt 3 ms 3600 KB
subtask0_sample_05.txt 2 ms 3480 KB
subtask1_01.txt 2 ms 3504 KB
subtask1_02.txt 4 ms 3580 KB
subtask1_03.txt 3 ms 3448 KB
subtask1_04.txt 2 ms 3612 KB
subtask1_05.txt 2 ms 3572 KB
subtask1_06.txt 3 ms 3448 KB
subtask1_07.txt 2 ms 3616 KB
subtask1_08.txt 2 ms 3496 KB
subtask1_09.txt 5 ms 3612 KB
subtask1_10.txt 2 ms 3548 KB
subtask1_11.txt 2 ms 3564 KB
subtask1_12.txt 2 ms 3448 KB
subtask1_13.txt 2 ms 3504 KB
subtask2_01.txt 11 ms 3728 KB
subtask2_02.txt 7 ms 3620 KB
subtask2_03.txt 10 ms 3724 KB
subtask2_04.txt 11 ms 3624 KB
subtask2_05.txt 9 ms 3628 KB
subtask2_06.txt 9 ms 3672 KB
subtask2_07.txt 10 ms 3668 KB
subtask2_08.txt 12 ms 3764 KB
subtask2_09.txt 4 ms 3584 KB
subtask2_10.txt 2 ms 3524 KB
subtask2_11.txt 2 ms 3660 KB
subtask2_12.txt 2 ms 3568 KB