#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
while(cin>>a>>b>>c>>d)
{
if(b-a==d-c)
{
cout<<a*(0<=a&&a<=20)<<endl;
cout<<b*(b<=100000)<<endl;
cout<<c*(c<=100000)<<endl;
cout<<d*(d<=100000)<<endl;
cout<<(d+b-a)*((d+b-a)<=100000)<<endl;
}
if(b/a==d/c)
{
cout<<a*(0<=a<=20)<<endl;
cout<<b*(b<=100000)<<endl;
cout<<c*(c<=100000)<<endl;
cout<<d*(d<=100000)<<endl;
cout<<d*(d/c)*(d*(d/c)<=100000)<<endl;
}
}
return 0;
}
找好久不知道哪錯~請各位大大幫忙找一下嚕
很明顯的錯誤= =
我也挺好奇 你如何寫出那樣的程式碼....想聽聽看~~
以下是我以前的code
/**********************************************************************************/
/* Problem: a005 "Eva 的回家作業" from POJ */
/* Language: CPP */
/* Result: AC (34ms, 2280KB) on ZeroJudge */
/* Author: asas at 2009-01-23 02:53:57 */
/**********************************************************************************/
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
int a,b,c,d,t;
cin >> t;
while(t--)
{
cin >> a >> b >> c >> d;
if(c - b == d - c)
cout<< a << " " << b << " " << c << " " << d << " " << d + (d - c) <<endl;
else
cout<< a << " " << b << " " << c << " " << d << " " << d * (d / c) <<endl;
}
system("pause");
return 0;
}