QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#549255#9229. Juliet Unifies Onesclearlove13#WA 0ms3652kbC++231.7kb2024-09-06 13:26:232024-09-06 13:26:24

Judging History

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

  • [2024-09-06 13:26:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-09-06 13:26:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
#define pb push_back
typedef double db;
#define vel vector<long long>
#define ves vector<string>
typedef unsigned long long ull;
const double pi= std::acos(-1.0);
const ll lens=1e4+5;
const ll MAXN5=1e5+5;
//typedef pair<ll,ll> PLL;
ll xi[lens];
const ll M = 1e9+7;
ll yi[lens];
//ll bo[lens];
ll l,r,y;
ll n,m,r1,r2,i,j,k;
string na,te,ss,s;

void sol(){
    cin>>s;
    stack<char> st;
    string gd="";
    string ans="";
    for (ll i = 0; i < s.size(); ++i){
        if (gd.size()==0){
            gd+=s[i];
        }
        else{
            if (s[i]==gd[gd.size()-1]){
                gd+=s[i];
            }
            else{
                if (ans.size()==0){
                    if (gd[0]=='1'){
                        ans+='1';
                    }
                }
                else{
                    ans+=gd[0];
                }
                gd="";
                gd+=s[i];
            }
        }
    }
    if (gd.size()!=0){
        if (gd[0]=='1'){
            if (ans[ans.size()-1]=='0'){
                ans+='1';
            }
        }
    }
    ll rq=0;
    for (ll i = 0; i < ans.size(); ++i){
        if (ans[i]=='0'){
            if (i==ans.size()-1){
                continue;
            }
            else{
                if (ans[i+1]=='1'&&ans[i-1]=='1'){
                    rq++;
                }
            }
        }
    }
    cout<<rq<<"\n";

}
int main(){  
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while (t--){
        sol();
    }
    return 0;  
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3652kb

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3552kb

input:

11101111111111111101001011110111111110011101010110

output:

9

result:

wrong answer 1st numbers differ - expected: '11', found: '9'