QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#105245#5501. Ctrl+C Ctrl+Vpdstiago#RE 2ms3440kbC++14615b2023-05-13 19:41:162023-05-13 19:41:18

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-13 19:41:18]
  • 评测
  • 测评结果:RE
  • 用时:2ms
  • 内存:3440kb
  • [2023-05-13 19:41:16]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

#define mxn 1e5+5
#define fastio ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define endl '\n'
typedef long long ll;


int solve(){
    string s;
    cin >> s;

    int cont=0;

    int last=-1;

    for(int i=0; i<=s.size()-4; i++){
        string a = s.substr(i, 4);
        if(a=="ania"){
            if(last!=i) cont++;
            last = i+3;
        }
    }

    cout << cont << endl;
    return 0;
}

int main(){
    fastio;

    int t = 1; 
    cin >> t;

    while(t--){
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3440kb

input:

3
aniasieurodzilaapotemnicsieniedzialo
nicciekawegouanianiagnieszkianialicji
jeszczekrotszaautobiografiaani

output:

1
2
0

result:

ok 3 lines

Test #2:

score: -100
Dangerous Syscalls

input:

10000
aniaanianianianiaviananibnianianianianianiapianianianianianianiaanianianianiananianianianiananifw
ananiacnganiaaywbwrkaniahaniaganiaglljaniaouaqrdyaniaypvsgjltrbcvjssrtnehqfzpfvaniahwaniauzncovwfmiqejteiuaniacblxyfikauptesitsitvananianiajndy
anianianianianianiaanianianianianiaanianianianianiaa...

output:


result: