Cod sursa(job #2973478)
| Utilizator | Data | 31 ianuarie 2023 23:36:20 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
freopen("cifra.in", "r", stdin);
freopen("cifra.out", "w", stdout);
long long n;
cin >> n;
long long sum = 0;
int d, sume[n];
for (int j = 0; j < n; j++){
cin >> d;
for (int i = 1; i <= d; i++){
int termen = pow(i, i);
termen %= 10;
sum+=termen;
sum %= 10;
}
sume[j] = sum;
sum = 0;
}
for(auto i : sume) cout << i << endl;
return 0;
}