fork download
  1. #include <stdio.h>
  2. #define T 3400
  3. #define Z 31622
  4. #define M 100000"%d", &t);
  5. for(i = 0; i < t; i++)
  6. {
  7. scanf("%d %d", &m,&n);
  8. if(m==1)m=2;
  9. if(m<Z)
  10. {
  11. if(n>Z)
  12. {
  13. a=m;
  14. m=Z;
  15. A=0;
  16. B=T-1;
  17. while(a>primes[A] && a<primes[B] && B-A>1)
  18. if(a>primes[(A+B)/2])A=(A+B)/2;
  19. else B=(A+B)/2;
  20.  
  21. if(a<=primes[A])S=A;
  22. else S=B;
  23.  
  24. for(j=S;j<T;j++)
  25. printf("%d\n", primes[j]);
  26. }
  27. else
  28. {
  29. a=m;
  30. b=n;
  31. A=0;
  32. B=T-1;
  33.  
  34. while(a>primes[A] && a<primes[B] && B-A>1)
  35. if(a>primes[(A+B)/2])A=(A+B)/2;
  36. else B=(A+B)/2;
  37.  
  38. if(a<=primes[A])S=A;
  39. else S=B;
  40.  
  41. A=S;
  42. B=T-1;
  43.  
  44. while(b>primes[A] && b<primes[B] && B-A>1)
  45. if(b>primes[(A+B)/2])A=(A+B)/2;
  46. else B=(A+B)/2;
  47.  
  48. if(b>=primes[B])SS=B;
  49. else SS=A;
  50.  
  51. for(j=S;j<=SS;j++)
  52. printf("%d\n", primes[j]);
  53. }
  54. }
  55.  
  56. if(n>Z)
  57. {
  58. K = n-m+1;
  59. for( j = 0;j<K;j++)
  60. tab[j]=1;
  61.  
  62. for( j = 0; j<T; j++)
  63. {
  64. k=m;
  65. while(k%primes[j]>0 && k<=n)k++;
  66. k=k-m;
  67. while(k<K)
  68. {
  69. printf("@%d %d %d\n",k, primes[j], j);
  70. tab[k]=0;
  71. k+=primes[j];
  72. }
  73. }
  74.  
  75. for(j = 0;j<K;j++)
  76. if(tab[j])printf("%d\n", j+m);
  77. }
  78. }
  79.  
  80. return 0;
  81. } k=k-m;
  82. while(k<K)
  83. {
  84. printf("@%d %d %d\n",k, primes[j], j);
  85. tab[k]=0;
  86. k+=primes[j];
  87. }
  88. }
  89.  
  90. for(j = 0;j<K;j++)
  91. if(tab[j])printf("%d\n", j+m);
  92. }
  93. }
  94.  
  95. return 0;
  96. }
Compilation error #stdin compilation error #stdout 0.02s 2020KB
stdin
1
999900000 1000000000
compilation info
prog.c: In function ‘main’:
prog.c:12: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
prog.c:15: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
prog.c: At top level:
prog.c:89: warning: data definition has no type or storage class
prog.c:89: warning: type defaults to ‘int’ in declaration of ‘k’
prog.c:89: error: ‘m’ undeclared here (not in a function)
prog.c:90: error: expected identifier or ‘(’ before ‘while’
prog.c:96: error: expected identifier or ‘(’ before ‘}’ token
prog.c:98: error: expected identifier or ‘(’ before ‘for’
prog.c:98: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
prog.c:98: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘++’ token
prog.c:100: error: expected identifier or ‘(’ before ‘}’ token
prog.c:101: error: expected identifier or ‘(’ before ‘}’ token
prog.c:103: error: expected identifier or ‘(’ before ‘return’
prog.c:104: error: expected identifier or ‘(’ before ‘}’ token
stdout
Standard output is empty