Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
第一次WA,第二次AC,谁能告诉我区别在哪?#include <iostream> using namespace std; int main() { int n,i; double a,b,c,d; cin>>n; for(i=0;i<n;i++) { cin>>a>>b>>c>>d; if((b-a)==(c-b)) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+(b-a)<<endl; if((b/a)==(c/b)) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<(d*d)/c<<endl; } return 0; } ------------------------------------------------------------------------- #include <iostream> using namespace std; int main() { freopen("in.txt","r",stdin); int n,i; double a,b,c,d; cin>>n; for(i=0;i<n;i++) { cin>>a>>b>>c>>d; if(a+d==c+b) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+(b-a)<<endl; else cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<(d*d)/c<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator