Submission #16668605


Source Code Expand

Copy
//#define _GLIBCXX_DEBUG
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  string S; cin>>S;
  ll N=S.size();
  ll count=0;
  ll ans=0;
  rep(i,N){
    if(i<N-1&&S.substr(i,2)=="25"){
      while(i<N-1){
        if(S.substr(i,2)!="25") break;
        count++;
        i+=2;
      }
      ans+=count*(count+1)/2;
      count=0;
    }
  }
  
  cout<<ans<<'\n';
  
  return 0;
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User mogurin
Language C++ (GCC 9.2.1)
Score 100
Code Size 1052 Byte
Status
Exec Time 11 ms
Memory 3744 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 7 ms 3608 KB
subtask0_sample_02.txt 2 ms 3608 KB
subtask0_sample_03.txt 3 ms 3560 KB
subtask0_sample_04.txt 2 ms 3652 KB
subtask0_sample_05.txt 3 ms 3628 KB
subtask1_01.txt 2 ms 3472 KB
subtask1_02.txt 2 ms 3528 KB
subtask1_03.txt 2 ms 3632 KB
subtask1_04.txt 2 ms 3596 KB
subtask1_05.txt 2 ms 3676 KB
subtask1_06.txt 2 ms 3584 KB
subtask1_07.txt 3 ms 3528 KB
subtask1_08.txt 5 ms 3600 KB
subtask1_09.txt 1 ms 3624 KB
subtask1_10.txt 2 ms 3516 KB
subtask1_11.txt 2 ms 3652 KB
subtask1_12.txt 2 ms 3636 KB
subtask1_13.txt 7 ms 3620 KB
subtask2_01.txt 6 ms 3688 KB
subtask2_02.txt 8 ms 3592 KB
subtask2_03.txt 5 ms 3640 KB
subtask2_04.txt 9 ms 3688 KB
subtask2_05.txt 6 ms 3744 KB
subtask2_06.txt 7 ms 3692 KB
subtask2_07.txt 11 ms 3704 KB
subtask2_08.txt 7 ms 3636 KB
subtask2_09.txt 2 ms 3612 KB
subtask2_10.txt 2 ms 3540 KB
subtask2_11.txt 4 ms 3676 KB
subtask2_12.txt 2 ms 3604 KB