| Task: | Cent saving |
| Sender: | Barely Div 1 |
| Submission time: | 2016-05-28 12:10:28 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.08 s | details |
| #2 | WRONG ANSWER | 0.08 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:9:12: warning: unused variable 'p' [-Wunused-variable]
int t, n, p;
^Code
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
using namespace std;
int main() {
int t, n, p;
cin >> t;
for(int i=0; i<t; i++) {
cin >> n;
long long sum=0, p;
long long save=0, m3=0, m4=0;
for(int j=0; j<n; j++) {
cin >> p;
sum += p;
switch(p%5) {
case 0: break;
case 1: save++; break;
case 2: save+=2; break;
case 3: m3++; break;
case 4: m4++; break;
}
}
int c34 = min(m3, m4);
save += 2*c34;
m3 -= c34;
m4 -= c34;
save += m3/2;
save -= 2*(m3&1);
save += 2*m4/3;
save -= m4%3;
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 |
|---|
| 475191144965 460688647850 478543444029 475238936090 456736521510 ... Truncated |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 1 100000 666086355 190481330 514353517 ... |
| correct output |
|---|
| 47176864928795 |
| user output |
|---|
| 47176864928794 |
