杭电acm2007题,提交总是Presentation Error。。。帮忙看下什么情况
#include<iostream>usingnamespacestd;intmain(){inta,b;while(cin>>a>>b){intt,i,even=0,o...
#include <iostream>
using namespace std;
int main ()
{
int a,b;
while(cin>>a>>b)
{
int t,i,even=0,odd=0;
if(a>b)
{
t=a;
a=b;
b=t;
}
for(i=a; i<b+1; i++)
{
if(i%2==0)
even+=i*i;
else
odd+=i*i*i;
}
cout << even <<endl;
cout << odd <<endl;
}
system("pause");
return 0;
} 展开
using namespace std;
int main ()
{
int a,b;
while(cin>>a>>b)
{
int t,i,even=0,odd=0;
if(a>b)
{
t=a;
a=b;
b=t;
}
for(i=a; i<b+1; i++)
{
if(i%2==0)
even+=i*i;
else
odd+=i*i*i;
}
cout << even <<endl;
cout << odd <<endl;
}
system("pause");
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询