/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 15ms 328.0 KiB
#3 Wrong Answer 5ms 540.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
void solv()
{
    int n;
    cin>>n;
    string samp;
    cin>>samp;
    
    int sum = 0,flag = 0;
    for(int i = 0; i < n - 1; i++)
    {
        if(samp[i] == '1' && samp[i+1] == '1')
        {
            sum++;
        }
        else if(samp[i] == '1')
        {
            flag = 1;
        }
        else {
            continue;
        }
    }
    
    if(flag == 1 && sum == 0)
    {
        cout<<1<<endl;
    }
    else 
    {
        cout<<sum<<endl;
    }
    
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        solv();
    }
}

Information

Submit By
Type
Submission
Problem
P1113 Fliping Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 22:00:11
Judged At
2024-11-05 22:00:11
Judged By
Score
5
Total Time
15ms
Peak Memory
540.0 KiB