Linear Congruences by funnything

V,v,m,i,g,f,u,s;main(M){for(;~scanf("x = %d%*s%d%[)\n]",&v,&m,&s);V%=M*=m/g,f|=!u,s%3?printf(f?"no solutions\n":"%d + %dk\n",V,M),V=f=0,M=1:0)for(u=i=0;m/++i;g=m%i+M%i?g:i)V+=(V+M*i)%m==v?u=M*i:0;}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page