Cod sursa(job #870638)
Utilizator | Data | 3 februarie 2013 19:23:17 | |
---|---|---|---|
Problema | Invers modular | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include<iostream>
#include<fstream>
using namespace std;
main(){
ifstream f1("inversmodular.in");
int long long a,n,x,v[20001],i;
f1>>a>>n;
for(x=1;x<n-1;x++)
if((a*x)%n==1)
v[i]=x;
ofstream f2("inversmodular.out");
for(i=0;i<n-1;i++)
if(v[i])
f2<<v[i];
}