Task: | HIIT remains |
Sender: | Noname 01 |
Submission time: | 2016-05-28 11:24:36 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.05 s | details |
Code
// NONAME-01 #include <bits/stdc++.h> using namespace std; string s; void Load() { cin >> s; } void Solve() { int i; long long d1 = 0; long long d2 = 0; long long d3 = 0; long long d4 = 0; for (i = 0; i < (int)s.size(); i++) { if (s[i] == 'H') d1++; if (s[i] == 'I') { d3 += d2; d2 += d1; } if (s[i] == 'T') { d4 += d3; } } cout << d4 << "\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int nt, tt; cin >>nt; for (tt = 0; tt < nt; tt++) { Load(); Solve(); } return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
100 IIITIIIHITHTHIIITIII HIHIIIIIIHIIITHIIIII ITTIIIITIIIIIIITIIIT IITHITITIHHIITTTIIII ... |
correct output |
---|
12 84 0 37 96 ... |
user output |
---|
12 84 0 37 96 ... |
Test 2
Verdict: ACCEPTED
input |
---|
100 TIIHHITTITITIHTHIIIITHIHHIIHTI... |
correct output |
---|
606723862 621369559 655243897 550750615 717769300 ... |
user output |
---|
606723862 621369559 655243897 550750615 717769300 ... |
Test 3
Verdict: ACCEPTED
input |
---|
10 TTHTHHTIIIIIITHIIHIITITTITTIIH... |
correct output |
---|
64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 ... |
user output |
---|
64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 ... |
Test 4
Verdict: ACCEPTED
input |
---|
3 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
correct output |
---|
781234375000000000 4999750003 0 |
user output |
---|
781234375000000000 4999750003 0 |