Submission #16767812


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  string s;
  cin >> s;
  ll ans = 0;
  ll num = 0;
  int n = s.size();
  rep(i, n-1){
    if (s[i] == '2' && s[i+1] == '5'){
      num++;
      ans += num;
      i++;
    }else{
      num = 0;
    }
  }
  cout << ans << endl;
}

Submission Info

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

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 8 ms 3556 KB
subtask0_sample_02.txt 2 ms 3556 KB
subtask0_sample_03.txt 2 ms 3588 KB
subtask0_sample_04.txt 2 ms 3580 KB
subtask0_sample_05.txt 3 ms 3444 KB
subtask1_01.txt 2 ms 3524 KB
subtask1_02.txt 2 ms 3544 KB
subtask1_03.txt 5 ms 3516 KB
subtask1_04.txt 2 ms 3472 KB
subtask1_05.txt 2 ms 3572 KB
subtask1_06.txt 1 ms 3536 KB
subtask1_07.txt 2 ms 3520 KB
subtask1_08.txt 1 ms 3580 KB
subtask1_09.txt 3 ms 3516 KB
subtask1_10.txt 2 ms 3508 KB
subtask1_11.txt 2 ms 3588 KB
subtask1_12.txt 3 ms 3472 KB
subtask1_13.txt 3 ms 3376 KB
subtask2_01.txt 9 ms 3640 KB
subtask2_02.txt 5 ms 3712 KB
subtask2_03.txt 7 ms 3644 KB
subtask2_04.txt 8 ms 3712 KB
subtask2_05.txt 8 ms 3528 KB
subtask2_06.txt 6 ms 3636 KB
subtask2_07.txt 6 ms 3596 KB
subtask2_08.txt 8 ms 3592 KB
subtask2_09.txt 2 ms 3532 KB
subtask2_10.txt 3 ms 3492 KB
subtask2_11.txt 2 ms 3588 KB
subtask2_12.txt 4 ms 3540 KB