hdoj2007

来源:互联网 发布:pcb绘图软件中文版 编辑:程序博客网 时间:2024/06/01 10:21
 #include<iostream>//#include<cmath>using namespace std;int main(){    double x,y;    int n1,n2;    while( cin >> n1 >> n2 )    {           x = y = 0.0;           if( n1 > n2)           {               swap(n1,n2);               }           for ( int i = n1;i <= n2;i ++)           {               if(i % 2 == 0)               {                    x += i*i;                    }                    else                     {                          y += i*i*i;                         }               }               cout << x <<" " << y << endl;           }    system("pause");    }