Cod sursa(job #1434723)

Utilizator teoceltareconstantin teodor teoceltare Data 11 mai 2015 11:23:56
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int main()
{
    int t;
    int n,x,s=0,y;
    fin>>t;
    for(int a1=1;a1<=t;a1++){
    fin>>n;
    for(int a=1;a<=n;a++)
    {
        x=a;
        y=a;
        x%=4;
        x+=4;
        y=powl(y,x);
        s+=y%10;
        s%=10;
    }
    fout<<s<<'\n';
    s=0;}
}