|
|
вернуться в форумWA 11 Why? Послано SerCe 20 мар 2011 13:00 #include <iostream> #include <string> #include <algorithm> #include <vector> #include <stdio.h> #include <cmath> using namespace std; int p=0,n=0,V=0,T=0; char c; int a=0,b=0,c1=0,d=0; double R=8.314; int main() { for(int i = 0; i < 3; i++) { cin >> c; if(c=='p') { cin >> c; cin >> p; a++; } if(c=='n') { cin >> c; cin >> n; b++; } if(c=='V') { cin >> c; cin >> V; c1++; } if(c=='T') { cin >> c; cin >> T; d++; } } if(a==0) cout << "p = " << R*n*T/V; if(b==0) cout << "n = " << p*V/(R*T); if(c1==0) { if(p==0 && n==0) { cout << "undefined"; return 0; } if(p==0 || n==0) { cout << "error"; return 0; } cout << "V = " << R*n*T/p; } if(d==0) { if(p==0 && n==0) { cout << "undefined"; return 0; } if(p==0 || n==0) { cout << "error"; return 0; } cout << "T = " << p*V/(R*n); } return 0; } Так же было и на самом контесте WA 11, сейчас тоже WA 11, хотя на разборе говорили все тоже самое Edited by author 20.03.2011 13:07 Edited by author 20.03.2011 13:07 Re: WA 11 Why? Use printf; Re: WA 11 Why? Write something like this printf("n = %0.7Lf",rez); and be sure that you don't have any cout<<. I don't know the reason, this was my "mistake" and produced many WA :( Edited by author 14.07.2011 17:56 Re: WA 11 Why? You can also write with setprecision. I think you have to output at least 3 decimals but I'm not sure. Re: WA 11 Why? You must use fixed setprecision at least with 5 decimals: cout << fixed << setprecision(5); |
|
|