07/11/15 07:02:14
>>532
#include <iostream>
using namespace std;
#define N 4294967295 // 2^32 - 1
unsigned int amari(unsigned int x, unsigned int y){
int k=x-y;
if(k<0)k=-k;
if(x>k)x=k;
k=N/x;
int p=x/k,l=x%k;
return ((x*k)%y)*p+((x*l)%y)%y;}
main(){
int x=97,y=123;
cout<<amari(x,y)<<" "<<(x*x)%y;
}