Submission #15575282


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  string s;
  cin>>s;
  int n=s.size();
  int ans=0;
  for(int i=0;i<n;i++){
    int cnt=0;
    while(s.substr(i,2)=="25"){
     cnt++;
     i+=2;
   }
    ans+=(cnt)*(cnt+1)/2;
  }
  cout<<ans<<endl;
  return 0;
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User abc3
Language C++ (GCC 9.2.1)
Score 30
Code Size 841 Byte
Status
Exec Time 11 ms
Memory 3732 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 0 / 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 3572 KB
subtask0_sample_02.txt 3 ms 3556 KB
subtask0_sample_03.txt 2 ms 3472 KB
subtask0_sample_04.txt 2 ms 3488 KB
subtask0_sample_05.txt 2 ms 3520 KB
subtask1_01.txt 2 ms 3564 KB
subtask1_02.txt 2 ms 3608 KB
subtask1_03.txt 1 ms 3492 KB
subtask1_04.txt 2 ms 3644 KB
subtask1_05.txt 2 ms 3612 KB
subtask1_06.txt 1 ms 3560 KB
subtask1_07.txt 2 ms 3584 KB
subtask1_08.txt 2 ms 3444 KB
subtask1_09.txt 2 ms 3640 KB
subtask1_10.txt 2 ms 3476 KB
subtask1_11.txt 3 ms 3484 KB
subtask1_12.txt 2 ms 3608 KB
subtask1_13.txt 2 ms 3552 KB
subtask2_01.txt 8 ms 3720 KB
subtask2_02.txt 11 ms 3732 KB
subtask2_03.txt 10 ms 3684 KB
subtask2_04.txt 8 ms 3680 KB
subtask2_05.txt 10 ms 3732 KB
subtask2_06.txt 11 ms 3684 KB
subtask2_07.txt 8 ms 3724 KB
subtask2_08.txt 6 ms 3608 KB
subtask2_09.txt 2 ms 3660 KB
subtask2_10.txt 2 ms 3588 KB
subtask2_11.txt 4 ms 3464 KB
subtask2_12.txt 2 ms 3576 KB