Cod sursa(job #3210102)
Utilizator | Alexandru George Daniel Real_agd | Data | 4 martie 2024 21:04:33 |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main(){
int T, N, i, q, j, S=0, s;
ifstream cifra_in("cifra.in");
cifra_in>>T;
int Vsolutie[T];
for(i=0; i<T; i++){ // problema nr T
cifra_in>>N;
for(q=0; q<N; q++){
s=q+1;
for(j=0; j<q; j++){
s=(s%10)*(q+1);
}
S+=s;
s=0;
}
Vsolutie[i]=S%10;
S=0;
}
// moves the vector into the *out* file
ofstream cifra_out("cifra.out");
for(i=0; i<T; i++)
cifra_out<<Vsolutie[i]<<"\n";
return 0;
}