Cod sursa(job #1386630)

Utilizator issuePop Daniel issue Data 13 martie 2015 09:40:08
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("cifra.in");
ofstream four("cifra.out");

int puteri[] = {0, 1, 4, 7, 6, 5, 6, 3, 6, 9};
int rez[30000];

int main()
{
    unsigned long long i, n;
    int s = 0, t, j, cont = 0;
    fin >> t;
    for(j = 0; j < t; j++){
        fin >> n;
        s = 0;
        for(i = 1; i <= n; i++){
            s = s + puteri[i];
            s = s % 10;
        }
        rez[cont] = s;
        cont++;
    }
    for(i = 0; i < cont; i++) fout << rez[i] << "\n";
    return 0;
}