UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211149#3799. 猫哭FHL2310ms3268kbC++11673b2024-08-09 12:29:452024-08-09 12:58:29

answer

#include <iostream>  
#include <string>
#include <cstring> 
#include <algorithm>
using namespace std;
int solve(const string& s) {
    int ccnt = 0, acnt = 0, tcnt = 0;  
    for (char ch : s) {  
        if (ch == 'C') ccnt++;  
        else if (ch == 'A') acnt++;  
        else if (ch == 'T') tcnt++;  
    }
    int catcnt = min(ccnt, min(acnt - 1, tcnt - 1)), tatcnt = (tcnt - catcnt) / 2;
    return catcnt + tatcnt;  
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int T;  
    cin >> T;  
    while (T -- ) {  
        string s;  
        cin >> s; 
        cout << solve(s) << "\n";  
    }
    return 0;  
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

40
CCCATGCA
CCTATCAT
GTCTGCTA
ACACCTCC
TTATAACA
ATGATCAT
TATTACCA
CAAGCACC
CTCTCCTC
CTTTAAAT
CACTTCC...

output:

0
2
1
0
2
2
2
-1
1
2
1
0
2
2
2
1
0
1
2
1
0
1
1
2
2
1
2
2
1
1
2
2
2
2
1
1
2
2
2
-1

result:

wrong answer 1st words differ - expected: '1', found: '0'

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

40
GTACT
CATCT
ATAAT
TCAGT
ATTCG
ACTTT
TCCGA
CACTA
TGATC
TGTCA
AATAT
AACCT
TATCT
TCCTC
ATATG
AGTCA
C...

output:

1
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
1
0
1
-1
1
0
0
-1
1
0
0
0
1
1
1
1
0
0
1
1
1
-1
1

result:

wrong answer 5th words differ - expected: '0', found: '1'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

40
GCATTCTACCAGAGT
TGGGTATAAATTTCT
AAACCCTGTTTTTAC
TCCCATCTCAATCTG
CATCGCTTTAAACTT
TACACGATTCATCAC
T...

output:

3
4
4
3
4
3
4
3
3
4
5
3
3
3
4
4
4
3
4
2
4
4
3
2
2
5
2
2
4
3
2
4
4
3
4
4
3
4
4
3

result:

wrong answer 1st words differ - expected: '2', found: '3'

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

40
TAGACACTATCTTCC
CCTATCCCATACAAT
AGTCTTACCGCTCCA
AGCTCAAATAAATCA
GAACACCCCAAACAA
ATACCAACTCATCAA
C...

output:

4
3
3
2
-1
2
4
4
4
3
4
1
2
3
3
5
4
4
4
4
3
4
3
4
3
3
3
4
2
2
3
2
3
3
2
3
3
3
3
3

result:

wrong answer 1st words differ - expected: '3', found: '4'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

40
EJUPFQZTAJCKRQD
UMDIIZLTKGXGUUY
RNFTZBNKAYNSWZT
KEGHKRLQWKXJFSI
XZLUPCKNWHVBDZO
LYBUUCYFIUGEECF
Z...

output:

0
0
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
0
-1
-1
-1
1
-1
-1
-1
-1
0
0
-1
0
-1
-1
0
-1
-1
0
-1
-1
0
-1
-1
-...

result:

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

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

10
TAATTCCTACCTCTATAATAATACCCCACCCTACATCAATCGAATTTCAA
CACATAAATCCCCATCTAGTTCAGCTTTTTCTATAAACATAATATC...

output:

14
15
11
13
11
16
13
13
17
13

result:

wrong answer 1st words differ - expected: '11', found: '14'

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

10
ATATATCTGCTAGTCTTCGCCGCTACATAACGCTACTACGAATTGCAACC
TGATATCCTTCCCTTAGTTTATCATTGATATTATCACACAAAAATT...

output:

13
15
15
14
12
11
16
14
10
14

result:

wrong answer 1st words differ - expected: '8', found: '13'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

10
CGACGCCCTAACAAGCACGAACCTTTTTGCAACAGATATTCACAAATATG
TTATACCTTCACACTTTACTACATACAGCACTCGAAAGAAAGATCA...

output:

10
12
14
14
14
11
13
13
13
13

result:

wrong answer 1st words differ - expected: '11', found: '10'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

10
GAACAAACCATTGAGTTCATTGCACATCCGATACCTAAAAAACACTACAT
ACCCAGATCTACTCTCTTCTAACACTGATTGACAATTTGCTGAACC...

output:

10
13
11
11
6
14
12
12
13
15

result:

wrong answer 1st words differ - expected: '9', found: '10'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

19
GACTTACGCCCAAAAATCCCCGAGACGTCACTAAATCTCAAAAATTATTC
CTTCTAAATCTAATCCTATGTCGCCCTCCGCTCTGGGACTATTCTC...

output:

10
13
8
14
6
1
6
6
6
6
4
4
5
5
3
5
2
2
6

result:

wrong answer 1st words differ - expected: '9', found: '10'

Test #11:

score: 0
Wrong Answer
time: 1ms
memory: 1260kb

input:

19
TGCTTCCTGCATCGAAATGT
CACAAGTGAAATTGTTTACT
TGTTCAAACCAACCCTCTTC
ACTCTACCTGTCGCCAAATA
TGACACCTCATCG...

output:

5
5
5
4
4
5
4
6
3
4
6
1
3
5
4
14
10
15
9

result:

wrong answer 1st words differ - expected: '3', found: '5'

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

50
AAACAAATCT
TCCCAACAAC
TCTCAATTCC
CTCCATCTAA
GATAAACTCA
ACTTACGTTA
CTAATTCCCA
CTCTCACTCA
AATAATGCA...

output:

1
0
2
2
1
3
2
2
1
3
1
2
2
3
2
2
2
1
0
2
1
2
2
2
3
2
3
1
2
2
1
2
3
0
2
0
1
2
2
2
3
2
3
3
1
2
1
3
0
3

result:

wrong answer 4th words differ - expected: '1', found: '2'

Test #13:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

10
DOEHWYGHXGOJAQHEFUFFVAKMLNHMOXSUZWMNATIULQZQMCWZJA
NXJHYTEVCSYBGVASDYEQFCAYDXPYNDJQQJWLNJOWNOIWRX...

output:

0
0
1
0
0
1
2
0
1
2

result:

wrong answer 3rd words differ - expected: '0', found: '1'

Test #14:

score: 0
Wrong Answer
time: 1ms
memory: 1260kb

input:

62
AAATTTTTTTTATTTATTATTTTTTTTAATAAATTATATAATATTTTTAATTATTTTTTATTAATTTTAATTATTAATTATATTAAATTTTATTTAT...

output:

329
331
17
17
15
20
18
14
17
19
17
17
16
14
17
16
17
16
16
17
18
16
17
17
18
18
19
15
15
17
16
21
15...

result:

wrong answer 2nd words differ - expected: '328', found: '331'

Test #15:

score: 0
Wrong Answer
time: 0ms
memory: 1264kb

input:

5
TTATAATTTTTTTATTTTTTATTTATTTATTTAATATTTTTTATTTATTAAATATAATTTTTTATTTTTTTATTATTTAAATTTTTTATATAAAATAA...

output:

342
338
335
343
325

result:

wrong answer 1st words differ - expected: '313', found: '342'

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 1264kb

input:

5
TTATTATATTATTTTTTTATTAAATTATTTATATAAATAAATTATTTTTATTTTATTTTATTATTTTTATTTATTATTTTTTTATTTAAAAATTTTAT...

output:

333
342
344
342
333

result:

wrong answer 2nd words differ - expected: '315', found: '342'

Test #17:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

5
TAATTTATTTTATTTATTAAATTTTTATTTTAATAATATTTTAATTATTTATATTTTATTAATAATAATTTTTTTATTTAAATTTAATTATTTTTTTA...

output:

323
325
326
326
349

result:

wrong answer 5th words differ - expected: '301', found: '349'

Test #18:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

5
TTTATTTTTTTTTATTTTTATTTATTTAATTTATAATATTATTTTTTTTATAATTTTTTTTTTTTTATAAAATATTTTTATTTTTTTAATATATTTTT...

output:

338
331
330
337
333

result:

wrong answer 1st words differ - expected: '324', found: '338'

Test #19:

score: 0
Wrong Answer
time: 0ms
memory: 1264kb

input:

62
ATTTTTTTATATTTTTTTTTTTTTATTTTTATTATTATTATTTTTATTTA
ATTATATTTTATTAATTTTTAATTTTTTATTTTAATTTTAATTAAT...

output:

20
16
15
18
14
19
15
19
17
16
17
18
16
17
16
19
16
16
17
17
17
14
16
16
16
19
18
15
16
17
17
15
18
1...

result:

wrong answer 1st words differ - expected: '8', found: '20'

Test #20:

score: 0
Wrong Answer
time: 0ms
memory: 1264kb

input:

110
TATTAAATATATTAAATTTTTTTTATTAATTTATTATTTATTATTATATTATATTTTTTATATTTTTATAAAAATTTATTTTATTTATAATTAATA...

output:

98
101
103
104
103
99
104
98
103
100
8
8
6
6
6
6
7
8
7
4
8
6
7
6
5
7
7
6
6
6
7
8
7
8
8
7
7
7
7
5
7
6...

result:

wrong answer 2nd words differ - expected: '97', found: '101'

Test #21:

score: 0
Wrong Answer
time: 1ms
memory: 1264kb

input:

110
ATATATTTTTAATTTTTTAT
TTTTTTTAATTTTTATTATT
TTTATAAATAAAATTTTTTT
AATATTTATAATAATTTTAT
AAATTTATAATA...

output:

7
8
6
5
5
7
7
7
7
6
6
7
7
7
6
7
6
6
8
5
4
7
4
7
8
5
6
7
5
6
6
7
7
5
6
8
7
8
6
7
6
6
7
7
7
7
8
5
8
8
...

result:

wrong answer 1st words differ - expected: '5', found: '7'

Test #22:

score: 2
Accepted
time: 0ms
memory: 1264kb

input:

5
SXKKWHGPZMREKWJWXIEXUZXLQGVRPQKXQLASTFLUAPAPUSLGRPEINOXUBSXJLAQHQFNXPPBZZAJLXRIQTPNVJPJVAWXWINTTKO...

output:

18
15
17
25
19

result:

ok 5 tokens

Test #23:

score: 0
Wrong Answer
time: 14ms
memory: 3268kb

input:

2
TATATACAACATCTAGATCTCACTTGATTTCACTATTCAATTCCCATGTCCATACAACCGACTCAAATTCTAATTTTAGATTTACTAACCCATTACCG...

output:

305215
305635

result:

wrong answer 1st words differ - expected: '304734', found: '305215'

Test #24:

score: 0
Wrong Answer
time: 14ms
memory: 3268kb

input:

2
CCTGTCTATCAACCTCTAACACATAATCGGACTATGACCACTTGATTTTACCACTACCAGCTCAAATGAACACACTCTCTTTTCTTATTACTATCAAC...

output:

305440
305350

result:

wrong answer 1st words differ - expected: '305146', found: '305440'

Test #25:

score: 0
Wrong Answer
time: 17ms
memory: 3268kb

input:

2
TACCAACCTACTCGAGCTCCCTCTACAATTACGACTTCCTGAACTACCATACCAAACTGCTCTCGAATTGTATCGACATGATTAAGTCCCAATTCGAT...

output:

305216
305237

result:

wrong answer 1st words differ - expected: '304736', found: '305216'

Test #26:

score: 0
Wrong Answer
time: 16ms
memory: 3264kb

input:

2
CACACATTCTCTCTTATTCAGCCTATCCGTGAAAGTTGACATATATCATGTCAAAATGCCATCTTAACTTAATAACGTAAATCTACCGATCCATTTAT...

output:

305288
305640

result:

wrong answer 1st words differ - expected: '304589', found: '305288'

Test #27:

score: 0
Wrong Answer
time: 20ms
memory: 1936kb

input:

84
ATAGACCCCCCAACACCGCTACTAACTTTCCCTGATTATCCCCTGGCATCTCCATTGTTAAAACGCCCCTATTACGTAATTTTTGCGCGATATTTTA...

output:

91491
91616
91431
91391
3014
3044
2988
3052
3043
3014
3019
3021
3018
3038
3054
3057
3002
3011
3009
2...

result:

wrong answer 1st words differ - expected: '91027', found: '91491'

Test #28:

score: 0
Wrong Answer
time: 21ms
memory: 1940kb

input:

84
CTCCTCACCTTTAACGATCATACTCAATAACAGAACACCATTCGACCCCCTTTAACCATATGCCACGCCTGACTATTTCACTTCCTCCCTTGCCGAT...

output:

2993
3019
3025
3005
3034
3047
2984
3026
3025
3024
3045
3088
3001
3032
3057
3076
3042
3040
3044
3065
...

result:

wrong answer 1st words differ - expected: '2938', found: '2993'

Test #29:

score: 0
Wrong Answer
time: 18ms
memory: 2756kb

input:

10001
AAAGACGCTCCAACCAGCTATCTTTCCAAATGTTCCTCTACCCTACCTCAGCTTTCGTCCAATCCCAGAACCCTAGTTAATATAACTCTAAATA...

output:

305397
28
29
30
29
26
22
30
30
30
31
25
30
25
31
29
31
27
25
28
28
30
27
30
26
26
30
23
26
28
23
28
...

result:

wrong answer 1st words differ - expected: '304838', found: '305397'

Test #30:

score: 0
Wrong Answer
time: 19ms
memory: 2160kb

input:

2501
CGTCCACGTTGTCGCCCACTATATAAACTATCTCCCACTATGAAAGGCCCCTTTTAATAACCTCATCTCTTAAAGATAAATCCCTAATTACCCTA...

output:

115
121
121
125
123
119
122
108
122
111
120
111
115
123
113
119
125
114
118
104
116
119
121
112
124
...

result:

wrong answer 1st words differ - expected: '111', found: '115'

Test #31:

score: 0
Wrong Answer
time: 53ms
memory: 1264kb

input:

100000
TAAATTTACTACTCCTACCA
AACACATAAAACGCTTCTCA
CATATCTAAAAATAAACCTC
CGTCCCAACCTACCTCGCCT
TACGACCCA...

output:

6
3
4
3
1
6
5
5
3
2
4
5
3
4
4
5
6
3
5
5
3
3
1
6
6
3
4
2
3
3
0
7
4
3
7
4
4
5
6
5
5
3
4
4
6
3
5
4
3
-1...

result:

wrong answer 1st words differ - expected: '3', found: '6'

Test #32:

score: 0
Wrong Answer
time: 108ms
memory: 1556kb

input:

250005
TAGCAAATTTTACATAGCAATAATCACATAACTTACCTCATACTATAATAGAATCATTAACACCATGCCATCCCCTCTCATGTATACCTCTTT...

output:

30596
30539
30526
30513
30417
1
1
0
2
2
0
0
1
0
1
1
1
1
-1
-1
2
1
1
0
0
1
0
0
0
1
2
1
1
0
1
0
1
1
-1...

result:

wrong answer 1st words differ - expected: '30478', found: '30596'

Test #33:

score: 0
Wrong Answer
time: 4ms
memory: 2160kb

input:

1001
TAATACCTTCCCCCTTAATGAACCCATAGACCTTTCCCTTTAATAATTCTAATACAACCCTGGCCCCACACACAAATATAAACCAGGGTCAAAAA...

output:

289
291
293
301
290
278
290
286
298
301
298
299
302
301
288
300
310
302
293
296
299
298
310
303
300
...

result:

wrong answer 1st words differ - expected: '284', found: '289'

Test #34:

score: 0
Wrong Answer
time: 3ms
memory: 3264kb

input:

2
NPPZPXGAOITHNUMEIZSXQMQAZPYNBVBKYSJGJDMGEYQRYSPFBKJOJYIFRAJWFCQYOATYKHTBWXAKPVKFAXJBDBWIXDUBGRMGVG...

output:

38331
38554

result:

wrong answer 1st words differ - expected: '37993', found: '38331'