QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#227341 | #3424. Kindergarten Excursion | Bashca# | AC ✓ | 17ms | 5304kb | C++23 | 329b | 2023-10-27 12:38:14 | 2023-10-27 12:38:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin>>s;
int cnt[3] = {0};
long long sum = 0;
for (auto c : s) {
int x = c - '0';
for (int j=x+1; j<3; ++j) {
sum += cnt[j];
}
cnt[x]++;
}
cout << sum << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
22210
output:
7
result:
ok single line: '7'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
21000
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
012
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
000
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
22
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
211110
output:
9
result:
ok single line: '9'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
2202100122
output:
16
result:
ok single line: '16'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
02212012221
output:
15
result:
ok single line: '15'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
0222221102000022020112201112202100121102012221000202021001112112022110012201101020101012210020212010
output:
1829
result:
ok single line: '1829'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
202220102120000211021111000001022111210210100221001200012111020201120221110112211211221110010200001021022100110120000110020221101211011211202220012020112222120021121122100201022110200102220112121120001220111110102001011220201121202112100200122011202110110101100102221102220101000101122100011122210012...
output:
163572
result:
ok single line: '163572'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
001020012001012101011221201222112021212201210112112202220110021110110220202011211211202021211200210100000102021012212200002221022012221110211001122200102202212212101111222112220101222121222110222110210222021010202211221101222021102001111111122120000000100122121101102012112220021112101121221110121221...
output:
16833478
result:
ok single line: '16833478'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
001011111100002122000122101011012222011101111012110111211020112202100112212212202112002112112011111022221010220021101120201222020210122220010011201202021222000022101220121202100211000121202221011000212121200210101001102001202102022210010010021121012221222101121222222021012101010210020210102210001220...
output:
1658761856
result:
ok single line: '1658761856'
Test #14:
score: 0
Accepted
time: 17ms
memory: 5304kb
input:
012202121101120110022022020122222102102102102122002122110111022210212010120021201021000010222201100110211121121120211211120120022220000202002201121002102002221110121221011001121001201202100122220112200110102010010201022200122221222222200202201020121100000020221020111022202110222102212021102021122212...
output:
166578526591
result:
ok single line: '166578526591'
Test #15:
score: 0
Accepted
time: 13ms
memory: 5208kb
input:
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222022222222222222222222222022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222022222222222...
output:
934239149
result:
ok single line: '934239149'
Test #16:
score: 0
Accepted
time: 13ms
memory: 5188kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
977275719
result:
ok single line: '977275719'
Test #17:
score: 0
Accepted
time: 12ms
memory: 5252kb
input:
120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120120...
output:
166666833333
result:
ok single line: '166666833333'