/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 26ms 548.0 KiB
#3 Wrong Answer 8ms 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-11 02:25:30
Judged By
Score
5
Total Time
26ms
Peak Memory
548.0 KiB