[ZJ]d491: 我也愛偶數 (swap 版)

題目:
http://zerojudge.tw/ShowProblem?problemid=d491
-------------------------------------------------------------------------------------------------------------

#include<cstdio>
typedef long long int LL;
int main()
{
LL a,b;
while(scanf("%lld%lld",&a,&b)!=EOF)
{
if(a > b)
{
LL t = 0;
t = a;
a = b;
b = t;
}
if(a%2!=0)
a++;
LL sum = 0;
for(LL i=a;i<=b;i=i+2)
{
sum = sum + i;
}
printf("%lld\n",sum);
}
return 0;
}

留言

這個網誌中的熱門文章

[ZJ]b513: 判斷質數-商競103

[ZJ]d212: 東東爬階梯