fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a=0;
  5. int b=0;
  6. int p1=22, p2=17;
  7. int k1 = 4,k2 = 19;
  8. int n1 = 26;
  9. int running = 1;
  10.  
  11. k1 = k1 % n1;
  12. k2 = k2 % n1;
  13.  
  14. while( running ){
  15. int w1 = (p1*a + b)%n1;
  16. int w2 = (p2*a + b)%n1;
  17.  
  18. if( w1 == k1 && w2 == k2 ){
  19. printf( "a = %i, b = %i\n",a,b );
  20. puts( "continue? (y/n) ");
  21. char anw = getchar();
  22. if( anw == 'n' || anw == 'N' ) {
  23. // running = 0;
  24. break;
  25. }
  26. }
  27. if( b!=0 && (b%n1)==0 ){
  28. ++a;
  29. b = 0;
  30. }
  31. else
  32. ++b;
  33.  
  34.  
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0s 1724KB
stdin
yn
stdout
a = 23, b = 18
continue? (y/n) 
a = 49, b = 18
continue? (y/n)