Cod sursa(job #1453850)

Utilizator Player1Player 1 Player1 Data 24 iunie 2015 20:05:13
Problema Invers modular Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.33 kb
#include <stdio.h>

int main(){
	freopen("inversmodular.in","r",stdin);
	freopen("inversmodular.out","w",stdout);
	
	long long A, N, x, aux;
	bool as = false;

	scanf("%lld %lld ", &A, &N);

	x = 1;
	while(as == false){
		aux = N * x + 1;
		if ( aux % A == 0){
			as = true;
			printf("%lld", aux / A);
		}
		x++;
	}
	

	return 0;
}