QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#398419#3763. Absolute Difference EquationHjcc#WA 56ms4564kbC++14615b2024-04-25 11:56:072024-04-25 11:56:07

Judging History

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

  • [2024-04-25 11:56:07]
  • 评测
  • 测评结果:WA
  • 用时:56ms
  • 内存:4564kb
  • [2024-04-25 11:56:07]
  • 提交

answer

# include <bits/stdc++.h>
# define ll long long

using namespace std;

const int N = 1e6 + 5;
char s[N];
ll ans = 1, cnt = 0;
const ll mod = 1e9 + 7;

int main() {
# ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
# endif
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  while (cin >> s) {
    int n = strlen(s);
    bool fl = 0; cnt = 0; ans = 1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '?') {
        ++cnt;
        fl |= ((i | n - 1) == n - 1);
      }
    }
    cnt -= fl;
    while (cnt--) {
      ans = ans * 2 % mod;
    }
    cout << ans << '\n';
  }
}

详细

Test #1:

score: 0
Wrong Answer
time: 56ms
memory: 4564kb

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
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
2
1
1
1
1
1
1
2
2
2
1
1
2
1
1
2
2
2
4
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
2
1
1
2
2
2
4
1
1
1
1
1
1
1
1
2
1
1
1
1
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
1
1
1
1
1
1
2
2
2
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
4
4
4...

result:

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