| 
          【试题】连续奇数和 | 
        
                
          
            
                         一派掌門 二十級              | 
          
            
            
             
               标题:连续奇数和
      小明看到一本书上写着:任何数字的立方都可以表示为连续奇数的和。
      比如:   2^3 = 8 = 3 + 5 3^3 = 27 = 7 + 9 + 11 4^3 = 64 = 1 + 3 + ... + 15
      虽然他没有想出怎么证明,但他想通过计算机进行验证。
      请你帮助小明写出 111 的立方之连续奇数和表示法的起始数字。如果有多个表示方案,选择起始数字小的方案。        
      请严格按照要求,通过浏览器提交答案。     注意:只提交一个整数,不要写其它附加内容,比如:说明性的文字。
 
               
                       | 
        
                
          
            
                         一派掌門 二十級              | 
          
            
            
             
              【代码】 #include <stdio.h> #include <conio.h>
  #define f2013_2 main
  #define NUM 1367631 #define SUM ((start + end) * (end - start + 2) / 4)
  int f2013_2(void) {     int start, end;     int sum;     for (start = 1; start <= NUM; start += 2)     {         for (end = start + 2; (sum = SUM) <= NUM; end += 2)         {             printf("%d + ... + %d = %d", start, end, sum);             if (sum == NUM)             {                 puts("\nFound!");                 _getch();             }             else                 putchar('\n');         }     }     return 0; }              
             | 
|
        
                
          
            
                         一派掌門 二十級              | 
          
            
            
             
              【代码2】 #include <stdio.h> #include <conio.h>
  #define f2013_2 main
  #define NUM 1367631 #define SUM ((start + end) * (end - start + 2) / 4)
  int f2013_2(void) {     int start, end;     int sum;     for (start = 1; start <= NUM; start += 2)     {         for (end = start + 2; (sum = SUM) <= NUM; end += 2)         {             if (sum == NUM)                 printf("%d + ... + %d = %d\n", start, end, sum);         }     }     return 0; }              
             | 
|
        
                
          
            
                         一派掌門 二十級              | 
          
            
            
             
              【找到的算式】 371 + ... + 2367 = 1367631 3775 + ... + 4439 = 1367631 12211 + ... + 12431 = 1367631 36927 + ... + 36999 = 1367631 50627 + ... + 50679 = 1367631 151951 + ... + 151967 = 1367631 455875 + ... + 455879 = 1367631 Press any key to continue . . .              
             | 
|