QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#398652#3763. Absolute Difference Equationsycqwq#WA 155ms4700kbC++14641b2024-04-25 16:13:242024-04-25 16:13:25

Judging History

This is the latest submission verdict.

  • [2024-04-25 16:13:25]
  • Judged
  • Verdict: WA
  • Time: 155ms
  • Memory: 4700kb
  • [2024-04-25 16:13:24]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7,maxn=1e6+5;
char a[maxn];
int ksm(int x,int y)
{
    int s=1;
    if(y<0)
        return 0;
    while(y)
    {
        if(y&1)
            s=1ll*s*x%mod;
        x=1ll*x*x%mod,y>>=1;
    }
    return s;
}
int main()
{
    while(cin>>a+1)
    {
        int n=strlen(a+1);
        int qwq=0,qwq2=0;
        for(int i=1;i<=n;i++)
        {   
            qwq2+=a[i]=='?';
            qwq+=a[i]=='1';
        }
        if(qwq2==0)
            cout<<((qwq&1)==(n&1))<<'\n';
        else
            cout<<ksm(2,qwq2-1)<<'\n';
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 155ms
memory: 4700kb

input:

1
?????
1010?1?0
0
1
?
00
10
?0
01
11
?1
0?
1?
??
000
100
?00
010
110
?10
0?0
1?0
??0
001
101
?01
011
111
?11
0?1
1?1
??1
00?
10?
?0?
01?
11?
?1?
0??
1??
???
0000
1000
?000
0100
1100
?100
0?00
1?00
??00
0010
1010
?010
0110
1110
?110
0?10
1?10
??10
00?0
10?0
?0?0
01?0
11?0
?1?0
0??0
1??0
???0
0001
10...

output:

1
16
2
0
1
1
1
0
1
0
1
1
1
1
2
0
1
1
1
0
1
1
1
2
1
0
1
0
1
1
1
1
2
1
1
2
1
1
2
2
2
4
1
0
1
0
1
1
1
1
2
0
1
1
1
0
1
1
1
2
1
1
2
1
1
2
2
2
4
0
1
1
1
0
1
1
1
2
1
0
1
0
1
1
1
1
2
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
2
2
4
2
2
4
4
4
8
0
1
1
1
0
1
1
1
2
1
0
1
0
1
1
1
1
2
1
1
2
1
1
2
2
2
4...

result:

wrong answer 7th lines differ - expected: '0', found: '1'