Pagini recente » Cod sursa (job #2329839) | Cod sursa (job #1904135) | Cod sursa (job #2908951) | Cod sursa (job #347606) | Cod sursa (job #1189230)
/*
cifra infoarena
*/
#include<vector>
#include<string>
#include<string.h>
#include<algorithm>
#include<cstdio>
#include<fstream>
#include<iostream>
#include<ctime>
#include<set>
#include<map>
#include<cmath>
using namespace std;
#define LL long long
#define PII pair<int ,int>
#define PCI pair<char ,int>
#define VB vector <bool>
#define VI vector <int>
#define VC vector <char>
#define WI vector<VI>
#define WC vector<VC>
#define RS resize
#define X first
#define Y second
#define FORN(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define REPEAT do
#define UNTIL(x) while((x))
#define IN_FILE "cifra.in"
#define OUT_FILE "cifra.out"
ifstream f(IN_FILE);
ofstream g(OUT_FILE);
//variables
int t, n,maxi;
VI x,y;
//other functions
int calculare_n()
{
int cifra = 1;
FOR(i, 2, n)
{
int putere = i % 10;
if (putere > 0)
{
cifra += (int)pow(i,putere) % 10;
}
}
cifra %= 10;
return cifra;
}
void reading()
{
f >> t;
y.RS(t);
FORN(i, t)
{
f >> y[i];
maxi = max(y[i],maxi);
}
f.close();
}
void solving()
{
}
void write_data()
{
FORN(j, t)
{
int cifra = 1;
FOR(i, 2,y[j])
{
int putere = i % 10;
if (putere == 0)
{
//
}
else
{
cifra += (int)pow(i, putere);
cifra %= 10;
}
}
g << cifra << "\n";
}
}
int main()
{
reading();
solving();
write_data();
}