Pagini recente » Cod sursa (job #789323) | Cod sursa (job #48563) | Cod sursa (job #672586) | Cod sursa (job #2999513) | Cod sursa (job #3263800)
#include<fstream>
#define int long long
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
const int M=9973;
int32_t main(){
int q,n,exp,d,prod,nrdiv,sumdiv;
fin>>q;
while(q--){
fin>>n;
sumdiv=1;
nrdiv=1;
for(d=2;d*d<=n;d++){
if(n%d==0){
exp=0;
prod=d;
while(n%d==0){
exp++;
n=n/d%M;
prod=prod*d%M;
}
//fout<<d<<" "<<exp<<endl;
nrdiv=nrdiv*(exp+1)%M;
sumdiv=sumdiv*(prod-1)/(d-1)%M;
}
}
if(n>1){
nrdiv=nrdiv*2%M;
sumdiv=sumdiv*(n*n-1)/(n-1)%M;
}
//fout<<endl;
fout<<nrdiv<<" "<<sumdiv<<'\n';
}
}
/*
#include<fstream>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
int main(){
int q,n,exp,d,prod,nrdiv,sumdiv;
fin>>q;
while(q--){
fin>>n;
sumdiv=1;
nrdiv=1;
while(n>1){
exp=0;
prod=1;
while(n%d==0){
exp++;
n/=d;
prod*=d;
}
if(exp){
prod*=d;
nrdiv=nrdiv*(exp+1);
sumdiv=sumdiv*((prod-1)/(d-1));
}
d++;
//if(d*d>n)
// d=n;
}
fout<<nrdiv<<" "<<sumdiv<<'\n';
}
}
*/