fork download
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<iostream>
  4. using namespace std;
  5. int n ;
  6. int digits ( int num , int *f , int * s )
  7. {
  8. int i ;
  9. *f = 0 ;
  10. *s = 0 ;
  11. while ( num > 0 )
  12. {
  13. i = num % 10 ;
  14. if ( i == 4 )
  15. {
  16. (*f) ++ ;
  17. }
  18. else if ( i == 7 )
  19. {
  20. (*s) ++ ;
  21. }
  22.  
  23. num /= 10 ;
  24. }
  25. }
  26.  
  27.  
  28.  
  29. int equal ( int i , int j )
  30. {
  31. // if(j==i)
  32. // return 1;
  33. int fours = 0 ;
  34. int sevens = 0 ;
  35.  
  36. int f=0 , s=0 ;
  37. int k ;
  38. for ( k = i ; k <= j ; k ++ )
  39. {
  40. digits ( k , &f , &s ) ;
  41. fours += f ;
  42. sevens += s ;
  43. }
  44.  
  45. if ( fours == sevens )
  46. {
  47. //cout << "EQUAL " << i << " " << j << " " ;
  48. //cout << fours << " " << sevens << "\n" ;
  49. //getch () ;
  50. return 1 ;
  51. }
  52. return 0 ;
  53. }
  54.  
  55. int solution[100000] ;
  56. int solut[100000] ;
  57. void init ()
  58. {
  59. int i ;
  60. for ( i = 0 ; i < 100000 ; i ++ )
  61. {
  62. solution[i] = 0 ;
  63. }
  64. }
  65.  
  66. void update ( int i , int j )
  67. {
  68. int k = 1 ;
  69. //while ( k <= i && k <= j )
  70. //{
  71. // //solution[k] ++ ;
  72. // k ++ ;
  73. //}
  74.  
  75. k = i > j ? i : j ;
  76.  
  77. for ( ; k < 100000 ; k ++ )
  78. {
  79. solution[i] ++ ;
  80. }
  81. }
  82.  
  83. void print ()
  84. {
  85. int i ;
  86. for ( i = 1 ; i < n ; i ++ )
  87. {
  88. printf ( "%d " , solution[i] ) ;
  89. }
  90. printf ( "\n" ) ;
  91. }
  92.  
  93. int answer ()
  94. {
  95. int i , j ;
  96. int ans = 0 ;
  97. for ( i = 1 ; i <= n ; i ++ )
  98. {
  99. for ( j = i ; j <= n ; j ++ )
  100. {
  101. if ( equal ( i , j ) == 1 )
  102. {
  103. // update ( i , j ) ;
  104. ans ++ ;
  105. }
  106.  
  107. }
  108. }
  109. return ans ;
  110.  
  111. }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. int main ()
  119. {
  120.  
  121. int a , b ;
  122. int test ;
  123. scanf ( "%d" , &test ) ;
  124. while ( test -- )
  125. {
  126. // scanf ( "%d" , &n ) ;
  127. //digits ( n , &a , &b ) ;
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137. init () ;
  138.  
  139. //cout << a << " " << b ;
  140.  
  141. n=1;
  142. // cout<<answer () ;
  143. a=answer ();
  144. for(n=2;n<=100;n++)
  145. {
  146. b=answer();
  147. cout <<n<<" "<<answer () <<" "<<(b-a)<<endl;
  148. a=b;
  149. }
  150. printf("done");
  151. // print () ;
  152. }
  153. getch () ;
  154. }
  155.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
compilation info
prog.asm:1: error: label or instruction expected at start of line
prog.asm:2: error: label or instruction expected at start of line
prog.asm:3: error: label or instruction expected at start of line
prog.asm:4: error: parser: instruction expected
prog.asm:6: error: comma, colon or end of line expected
prog.asm:6: error: comma, colon or end of line expected
prog.asm:7: error: label or instruction expected at start of line
prog.asm:9: error: label or instruction expected at start of line
prog.asm:10: error: label or instruction expected at start of line
prog.asm:11: error: parser: instruction expected
prog.asm:12: error: label or instruction expected at start of line
prog.asm:13: error: parser: instruction expected
prog.asm:14: error: parser: instruction expected
prog.asm:15: error: label or instruction expected at start of line
prog.asm:16: error: label or instruction expected at start of line
prog.asm:17: error: label or instruction expected at start of line
prog.asm:18: error: parser: instruction expected
prog.asm:19: error: label or instruction expected at start of line
prog.asm:20: error: label or instruction expected at start of line
prog.asm:21: error: label or instruction expected at start of line
prog.asm:23: error: parser: instruction expected
prog.asm:24: error: label or instruction expected at start of line
prog.asm:25: error: label or instruction expected at start of line
prog.asm:29: error: comma, colon or end of line expected
prog.asm:29: error: comma, colon or end of line expected
prog.asm:30: error: label or instruction expected at start of line
prog.asm:31: error: label or instruction expected at start of line
prog.asm:32: error: label or instruction expected at start of line
prog.asm:33: error: comma, colon or end of line expected
prog.asm:34: error: comma, colon or end of line expected
prog.asm:36: error: comma, colon or end of line expected
prog.asm:36: error: comma, colon or end of line expected
prog.asm:38: error: parser: instruction expected
prog.asm:39: error: label or instruction expected at start of line
prog.asm:40: error: parser: instruction expected
prog.asm:41: error: parser: instruction expected
prog.asm:42: error: parser: instruction expected
prog.asm:43: error: label or instruction expected at start of line
prog.asm:45: error: symbol `if' redefined
prog.asm:45: error: parser: instruction expected
prog.asm:46: error: label or instruction expected at start of line
prog.asm:47: error: label or instruction expected at start of line
prog.asm:48: error: label or instruction expected at start of line
prog.asm:49: error: label or instruction expected at start of line
prog.asm:50: error: parser: instruction expected
prog.asm:51: error: label or instruction expected at start of line
prog.asm:52: error: symbol `return' redefined
prog.asm:52: error: parser: instruction expected
prog.asm:53: error: label or instruction expected at start of line
prog.asm:55: error: comma, colon or end of line expected
prog.asm:56: error: comma, colon or end of line expected
prog.asm:57: error: parser: instruction expected
prog.asm:58: error: label or instruction expected at start of line
prog.asm:60: error: symbol `for' redefined
prog.asm:60: error: parser: instruction expected
prog.asm:61: error: label or instruction expected at start of line
prog.asm:62: error: parser: instruction expected
prog.asm:63: error: label or instruction expected at start of line
prog.asm:64: error: label or instruction expected at start of line
prog.asm:66: error: symbol `void' redefined
prog.asm:66: error: parser: instruction expected
prog.asm:67: error: label or instruction expected at start of line
prog.asm:68: error: comma, colon or end of line expected
prog.asm:69: error: label or instruction expected at start of line
prog.asm:70: error: label or instruction expected at start of line
prog.asm:71: error: label or instruction expected at start of line
prog.asm:72: error: label or instruction expected at start of line
prog.asm:73: error: label or instruction expected at start of line
prog.asm:75: error: parser: instruction expected
prog.asm:77: error: symbol `for' redefined
prog.asm:77: error: parser: instruction expected
prog.asm:78: error: label or instruction expected at start of line
prog.asm:79: error: symbol `solution' redefined
prog.asm:79: error: parser: instruction expected
prog.asm:80: error: label or instruction expected at start of line
prog.asm:81: error: label or instruction expected at start of line
prog.asm:83: error: symbol `void' redefined
prog.asm:83: error: parser: instruction expected
prog.asm:84: error: label or instruction expected at start of line
prog.asm:86: error: symbol `for' redefined
prog.asm:86: error: parser: instruction expected
prog.asm:87: error: label or instruction expected at start of line
prog.asm:88: error: parser: instruction expected
prog.asm:89: error: label or instruction expected at start of line
prog.asm:90: error: symbol `printf' redefined
prog.asm:90: error: parser: instruction expected
prog.asm:91: error: label or instruction expected at start of line
prog.asm:93: error: comma, colon or end of line expected
prog.asm:94: error: label or instruction expected at start of line
prog.asm:96: error: comma, colon or end of line expected
prog.asm:97: error: symbol `for' redefined
prog.asm:97: error: parser: instruction expected
prog.asm:98: error: label or instruction expected at start of line
prog.asm:99: error: symbol `for' redefined
prog.asm:99: error: parser: instruction expected
prog.asm:100: error: label or instruction expected at start of line
prog.asm:101: error: symbol `if' redefined
prog.asm:101: error: parser: instruction expected
prog.asm:102: error: label or instruction expected at start of line
prog.asm:103: error: label or instruction expected at start of line
prog.asm:104: error: parser: instruction expected
prog.asm:105: error: label or instruction expected at start of line
prog.asm:107: error: label or instruction expected at start of line
prog.asm:108: error: label or instruction expected at start of line
prog.asm:109: error: symbol `return' redefined
prog.asm:109: error: parser: instruction expected
prog.asm:111: error: label or instruction expected at start of line
prog.asm:118: error: comma, colon or end of line expected
prog.asm:119: error: label or instruction expected at start of line
prog.asm:123: error: parser: instruction expected
prog.asm:124: error: symbol `while' redefined
prog.asm:124: error: parser: instruction expected
prog.asm:125: error: label or instruction expected at start of line
prog.asm:126: error: label or instruction expected at start of line
prog.asm:127: error: label or instruction expected at start of line
prog.asm:137: error: parser: instruction expected
prog.asm:139: error: label or instruction expected at start of line
prog.asm:141: error: parser: instruction expected
prog.asm:142: error: label or instruction expected at start of line
prog.asm:143: error: parser: instruction expected
prog.asm:144: error: symbol `for' redefined
prog.asm:144: error: parser: instruction expected
prog.asm:145: error: label or instruction expected at start of line
prog.asm:146: error: parser: instruction expected
prog.asm:147: error: parser: instruction expected
prog.asm:148: error: symbol `a' redefined
prog.asm:148: error: parser: instruction expected
prog.asm:149: error: label or instruction expected at start of line
prog.asm:150: error: symbol `printf' redefined
prog.asm:150: error: parser: instruction expected
prog.asm:151: error: label or instruction expected at start of line
prog.asm:152: error: label or instruction expected at start of line
prog.asm:153: error: parser: instruction expected
prog.asm:154: error: label or instruction expected at start of line
stdout
Standard output is empty