Cod sursa(job #2330287)
Utilizator | Data | 28 ianuarie 2019 10:42:05 | |
---|---|---|---|
Problema | Sum | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("sum.in");
ofstream out("sum.out");
bool p ( int x , int y){
int r = x%y;
while(r){
x = y;
y = r;
r = x%y;
}
return (y==1);
}
int main(){
long long n,x,s=0;
in >> n;
for(int i = 1;i<=n;++i){
s = 1;
in >> x;
for(int j = 2 ; j <= 2*x; ++j){
if( p(x,j))
{
cout<<"j : "<<j<<endl;
s += j;
}
}
out<<s<<endl;
}
}