Linear Congruences by nn

for(;l=readline();print(i<m?i+' + '+m+'k':'no solutions')){for(b=[j=k=n=0];[,it[n],b[n++]]=/(\d+).* (\d+)/(l),l=readline(););for(m=b[j];++j<n;m=w/m)for(z=b[j],w=m*z;z;)z=m%(m=z)
for(i=-1;k<n&&++i<m;)for(k=0;k<n&&i%b[k]==it[k];)k++}

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

download

return to the top page