首页 > 其他 > 详细

HDU_2007

时间:2015-05-28 17:46:44      阅读:137      评论:0      收藏:0      [点我收藏+]
 1 /**
 2 *注意:输入的两个数字的大小并不确定
 3 */
 4 #include <iostream>
 5 #include <stdio.h>
 6 #include <string.h>
 7 #include <math.h>
 8 #include <stdlib.h>
 9 
10 using namespace std;
11 
12 int main()
13 {
14     int i,res1;
15     int res2,x,y;
16     while(~scanf("%d%d",&x,&y))
17     {
18         res1 = 0;
19         res2 = 0;
20         if(x > y)
21          {
22              i = x;
23              x = y;
24              y = i;
25          }
26         for(i = x ;i <= y;i ++)
27         {
28 
29            // scanf("%d",&num);
30             if(i % 2 != 0)
31             {
32                 res1 += i * i * i;
33             }else{
34                 res2 += i * i;
35             }
36         }
37         printf("%d %d\n",res2,res1);
38     }
39     //cout << "Hello world!" << endl;
40     return 0;
41 }

 

HDU_2007

原文:http://www.cnblogs.com/banshaohuan/p/4536322.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!