各位大大幫忙看看吧ORZ
#include<iostream>
using namespace std;
int main()
{
int a,m,r,s;
while(cin>>a)
{
int x[a],y[a];
for(int k=0;k<a;k++)
cin>>x[k]>>y[k];
for(int k=0;k<a;k++)
{
m=0;
r=x[k];
s=y[k];
if(r%2==1 && s%2==1)
m=(r+s)*((s-r)/2+1)/2;
else if(r%2==0 && s%2==1)
m=(r+s+1)*((s-r-1)/2+1)/2;
else if(r%2==1 && s%2==0)
m=(r+s-1)*((s-1-r)/2+1)/2;
else
m=(r+s)*((s-2-r)/2+1)/2;
cout<<"Case "<<k+1<<": "<<m<<endl;
}
}
return 0 ;
}
各位大大幫忙看看吧ORZ
#include
using namespace std;
int main()
{
int a,m,r,s;
while(cin>>a)
{
int x[a],y[a];
for(int k=0;k cin>>x[k]>>y[k];
for(int k=0;k {
m=0;
r=x[k];
s=y[k];
if(r%2==1 && s%2==1)
m=(r+s)*((s-r)/2+1)/2;
else if(r%2==0 && s%2==1)
m=(r+s+1)*((s-r-1)/2+1)/2;
else if(r%2==1 && s%2==0)
m=(r+s-1)*((s-1-r)/2+1)/2;
else
m=(r+s)*((s-2-r)/2+1)/2;
cout<<"Case "<
while拿掉就過了
各位大大幫忙看看吧ORZ
#include
using namespace std;
int main()
{
int a,m,r,s;
while(cin>>a)
{
int x[a],y[a];
for(int k=0;k cin>>x[k]>>y[k];
for(int k=0;k {
m=0;
r=x[k];
s=y[k];
if(r%2==1 && s%2==1)
m=(r+s)*((s-r)/2+1)/2;
else if(r%2==0 && s%2==1)
m=(r+s+1)*((s-r-1)/2+1)/2;
else if(r%2==1 && s%2==0)
m=(r+s-1)*((s-1-r)/2+1)/2;
else
m=(r+s)*((s-2-r)/2+1)/2;
cout<<"Case "<
while拿掉就過了
感謝^^
AC了
各位大大幫忙看看吧ORZ
#include
using namespace std;
int main()
{
int a,m,r,s;
while(cin>>a)
{
int x[a],y[a];
for(int k=0;k cin>>x[k]>>y[k];
for(int k=0;k {
m=0;
r=x[k];
s=y[k];
if(r%2==1 && s%2==1)
m=(r+s)*((s-r)/2+1)/2;
else if(r%2==0 && s%2==1)
m=(r+s+1)*((s-r-1)/2+1)/2;
else if(r%2==1 && s%2==0)
m=(r+s-1)*((s-1-r)/2+1)/2;
else
m=(r+s)*((s-2-r)/2+1)/2;
cout<<"Case "<
while拿掉就過了
感謝^^
AC了
各位大大幫忙看看吧ORZ
#include
using namespace std;
int main()
{
int a,m,r,s;
while(cin>>a)
{
int x[a],y[a];
for(int k=0;k cin>>x[k]>>y[k];
for(int k=0;k {
m=0;
r=x[k];
s=y[k];
if(r%2==1 && s%2==1)
m=(r+s)*((s-r)/2+1)/2;
else if(r%2==0 && s%2==1)
m=(r+s+1)*((s-r-1)/2+1)/2;
else if(r%2==1 && s%2==0)
m=(r+s-1)*((s-1-r)/2+1)/2;
else
m=(r+s)*((s-2-r)/2+1)/2;
cout<<"Case "<
while拿掉就過了
感謝^^
AC了