QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#559205 | #8832. Daily Disinfection | clearlove13# | WA | 2ms | 3644kb | C++23 | 1.0kb | 2024-09-11 20:48:22 | 2024-09-11 20:48:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ull = unsigned long long;
#define ff(x) fixed << setprecision(x)
#define vel vector<long long>
#define vei vector<int>
#define ves vector<string>
#define asn ans
constexpr int inf = 0x3f3f3f3f;
constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr db EPS = 1.0e-9;
constexpr ll MOD = 998244353LL;
constexpr ll SZ = 1e6;
constexpr ll MAXN5 = 2e5 + 5;
constexpr ll MAXN6 = 2e6 + 5;
ll n, m;
void Solve(void) {
cin >> n;
string s;
cin >> s;
int ans = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '1') {
ans++;
}
}
if (n >= 3 && s[n - 1] == '1' && s[n - 2] == '0' && s[n - 3] == '1') {
ans++;
}
cout << ans << '\n';
}
int main(void) {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
// freopen("mine.in", "r", stdin);
// freopen("mine.out", "w", stdout);
int cas = 1;
cin >> cas;
while (cas--)
Solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
3 2 01 5 00110 9 101010101
output:
1 2 6
result:
ok 3 number(s): "1 2 6"
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3508kb
input:
10000 15 010111111011011 10 1000101111 10 0011111101 1 0 3 110 4 1000 8 10000111 20 00000101000100001110 13 1101110110110 13 0111100011010 17 00001001111110101 1 0 20 10001010011000111100 11 00100110101 11 10110101000 15 001011110011000 16 1110111110000111 15 011110110110010 1 0 20 10110001101100010...
output:
11 6 8 0 2 1 4 6 9 7 10 0 9 6 5 7 11 9 0 9 8 8 3 6 0 6 2 5 4 8 10 4 7 1 7 2 1 9 1 7 11 9 13 5 11 13 15 6 3 4 5 1 1 8 7 5 3 0 0 12 8 5 6 7 6 4 9 1 4 5 12 0 2 10 4 3 7 7 3 7 4 3 8 9 15 2 6 6 9 8 6 1 3 4 2 11 10 5 0 0 5 7 4 7 0 4 7 9 3 4 10 3 6 11 8 1 8 6 5 2 4 9 7 1 5 7 8 3 5 11 6 11 8 8 9 16 2 7 6 3 ...
result:
wrong answer 3rd numbers differ - expected: '7', found: '8'