Cod sursa(job #2000884)
Utilizator | Darjan Catalin dex4 | Data | 14 iulie 2017 22:42:42 |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
int n, t;
int pow[] = {0, 1, 4, 7, 6, 5, 6, 3, 6, 9};
ofstream g("cifra.out");
void solve(int n){
int sum=0;
for(int i=1; i<=n; i++)
sum += pow[i%10];
g << sum%10 << "\n";
}
void read(){
ifstream f("cifra.in");
f >> t;
for(int i=1; i<=t; i++){
f >> n;
solve(n);
}
}
int main()
{
read();
return 0;
}