Task: | Cent saving |
Sender: | zah |
Submission time: | 2016-05-28 13:24:56 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
Code
#include <iostream>using namespace std;//ios_base::sync_with_stdio(0);//cin.tie(0);int main(){ios_base::sync_with_stdio(0);cin.tie(0);long long t;cin >> t;long long n;long long x;long long modulo;long long kol;long long nel;long long summa;long long tmp;/*int alkuluvut[1001] = {};alkuluvut[1] = 1;for(int i=2; i<100; i++) {for(int j=i*i; j<1001; j+=i) alkuluvut[j]=1;} */for(int i=0; i<t; i++) {cin >> n;summa = 0;kol = 0;nel = 0;for(int j=0; j<n; j++) {cin >> x;summa += x;modulo = x%5;if(modulo<3) {summa -= modulo;} else {if(modulo==4) {nel += 1;} else kol += 1;}}tmp = min(kol,nel);summa -= 2*tmp;kol -= tmp;nel -= tmp;if(kol==0) {summa -= 2*(nel/3);summa += nel%3 ;} else {summa -= kol/2;summa += (kol%2)*2;}cout << summa << "\n";}}
Test details
Test 1
Verdict: ACCEPTED
input |
---|
100 1000 528433894 255789530 559301042 ... |
correct output |
---|
475191144965 460688647850 478543444030 475238936090 456736521510 ... |
user output |
---|
475191144965 460688647850 478543444030 475238936090 456736521510 ... Truncated |
Test 2
Verdict: ACCEPTED
input |
---|
1 100000 666086355 190481330 514353517 ... |
correct output |
---|
47176864928795 |
user output |
---|
47176864928795 |