Task: | Cent saving |
Sender: | ContinuedLife |
Submission time: | 2016-05-28 15:07:52 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.06 s | details |
#2 | WRONG ANSWER | 0.05 s | details |
Code
#include <bits/stdc++.h> #define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(6); using namespace std; bool mycomp(int a, int b){ return a > b; } int main(){ _ int TC; cin >> TC; while(TC--){ int n,sum = 0, num; cin >> n; int n1 = 0, n2 = 0, save = 0; for(int i = 0; i < n; ++i){ cin >> num; sum += num; num %= 5; switch(num){ case 0: num = 0; break; case 1: num = -1; break; case 2: num = -2; break; case 3: num = 2; break; case 4: num = 1; break; } if(num == 1) n1 += 1; if(num == 2) n2 += 1; if(num <= 0) save += num; } int minN = min(n1, n2); save += -2 * minN; n1 -= minN; n2 -= minN; if(n1 != 0){ int beishu = n1 / 3; save += -2*beishu + n1%3; } else { int beishu = n2/ 2; save += -1 * beishu + n2%2*2; } cout << sum + save << endl; } return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 1000 528433894 255789530 559301042 ... |
correct output |
---|
475191144965 460688647850 478543444030 475238936090 456736521510 ... |
user output |
---|
-1550224891 1127147178 1802074174 -1502433766 1469988134 ... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
1 100000 666086355 190481330 514353517 ... |
correct output |
---|
47176864928795 |
user output |
---|
944149531 |