fork download
  1. /* @file 11461.c
  2.  * @date 04/24/2011
  3.  * @version v0.01
  4.  * @author "TXShon" <txshon@gmail.com>
  5.  * @note CreativeCommons(cc) 2011 TXShon, cc by-nc-nd
  6.  *
  7.  *Description
  8.  * Acm practice using c
  9.  *History
  10.  */
  11. #include <stdio.h>
  12.  
  13. int num[100500];
  14.  
  15. int main()
  16. {
  17. int a, b, k, kk,i;
  18.  
  19. k = 1;
  20. kk = 1;
  21. for( i=0; i<100003; i++){
  22. num[i]=k-1;
  23. if(i==kk){
  24. k++;
  25. kk=k*k;
  26. }
  27. }
  28.  
  29. while( scanf("%d%d", &a, &b)==2){
  30. if( a==0 && b==0)break;
  31. printf("%d\n", num[b+1]-num[a]);
  32. }
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 2116KB
stdin
1 4
1 10
0 0
stdout
2
3