Show all threads Hide all threads Show all messages Hide all messages |
So hard... | Programmer | 1823. Ideal Gas | 18 Nov 2015 21:58 | 1 |
If you are not understand problem: when print undefined and when error, try to brute force it:) |
nail down checking order , might help | esbybb | 1823. Ideal Gas | 11 Sep 2015 07:49 | 1 |
p n p=0 and n=0 undefined p=0 and n!=0 error p!=0 and n=0 error v (p=0 error, n=0 undefined, vg<=0 error) t (n=0 error, p=0 undefined, tg<=0 error) |
WA 11 Why? | SerCe | 1823. Ideal Gas | 15 Aug 2014 21:45 | 5 |
#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 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 You can also write with setprecision. I think you have to output at least 3 decimals but I'm not sure. You must use fixed setprecision at least with 5 decimals: cout << fixed << setprecision(5); |
Test 12 | [RISE] Levon Oganesyan [RAU] | 1823. Ideal Gas | 15 Aug 2014 21:23 | 1 |
Test 12 [RISE] Levon Oganesyan [RAU] 15 Aug 2014 21:23 in 12 test answer is p = 0. I write in my code "0" instead of "p = 0" and have WA12. Good Luck! |
For whom, who get WA 6,7 | Gleb_Kazantaev(NNSTU) | 1823. Ideal Gas | 4 Jun 2014 03:04 | 1 |
double res = (bpi*bvi)/(bti*R); cout << "n = "; if(res < 1) printf("%.0f", res); else printf("%.6f", res); When res (n) < 1 u should cout 0 else u should cout number with an error. Good Luck! |
WA4 | BhandariEkaterina(MUCTR-2013) | 1823. Ideal Gas | 18 Sep 2013 21:19 | 1 |
WA4 BhandariEkaterina(MUCTR-2013) 18 Sep 2013 21:19 Can anyone help me with test 4? #include <iostream> #include <cstdio> using namespace std; int main() { char c[3]; float v[3]; float R = 8.314, p, V, T, n; scanf("%c = %f\n", &c[0], &v[0]); scanf("%c = %f\n", &c[1], &v[1]); scanf("%c = %f", &c[2], &v[2]); for(int i = 0; i < 3; i++) { if(c[i] == 'p') p = v[i]; else if(c[i] == 'V') V = v[i]; else if(c[i] == 'T') T = v[i]; else if(c[i] == 'n') n = v[i]; } if(c[0] != 'n' && c[1] != 'n' && c[2] != 'n') { n = p*V/(R*T); if(T == 0 && (p == 0 || V == 0)) cout << "undefined\n"; else if(T == 0 && (p != 0 || V != 0)) cout << "error\n"; else if(p < 0 || V < 0 || T < 0 || n < 0) cout << "error\n"; else printf("n = %f\n", n); } else if(c[0] != 'T' && c[1] != 'T' && c[2] != 'T') { T = p*V/(R*n); if(n == 0 && (p == 0 || V == 0)) cout << "undefined\n"; else if(n == 0 && (p != 0 || V != 0)) cout << "error\n"; else if(p < 0 || V < 0 || n < 0 || T < 0) cout << "error\n"; else printf("T = %f\n", T); } else if(c[0] != 'V' && c[1] != 'V' && c[2] != 'V') { V = n*T*R/p; if(p == 0 && (T == 0 || n == 0)) cout << "undefined\n"; else if(p == 0 && (T != 0 || n != 0)) cout << "error\n"; else if(p < 0 || T < 0 || n < 0 || V < 0) cout << "error\n"; else printf("V = %f\n", V); } else if(c[0] != 'p' && c[1] != 'p' && c[2] != 'p') { p = n*T*R/V; if(T == 0 && (n == 0 || V == 0)) cout << "undefined\n"; else if(T == 0 && (n != 0 || V != 0)) cout << "error\n"; else if(V < 0 || n < 0 || T < 0) cout << "error\n"; else printf("p = %f\n", p); } return 0; } |
WA 6? what is test? | orcchg | 1823. Ideal Gas | 9 Jun 2013 01:54 | 3 |
No prob, i proceed to AC now. I guess, Test 6 is: T != 0.0 V != 0.0 p == 0.0 n - ? Ans: n = 0 (just 0, not 0.000000) T != 0.0 V != 0.0 n == 0.0 p - ? Ans: same here, p = 0 your answer is wrong . because it becomes T != 0 and V != 0 and n == 0 answer is error! i think answer is "error" when n != 0 and p == 0 or p != 0 and n == 0 ... |
WA6 | Shree | 1823. Ideal Gas | 10 Feb 2013 04:21 | 1 |
WA6 Shree 10 Feb 2013 04:21 What is test 6? I am stuck at it for a very long time! |
6 test!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | Dimonka | 1823. Ideal Gas | 13 Nov 2012 16:18 | 2 |
if ((p = 0) and (n = 0)) and ((Pc = 1) and (Nc = 1)) then writeln('undefined'); if (((p = 0) and (n <> 0)) or ((p <> 0) and (n = 0)))and ((Pc = 1) and (Nc = 1)) then writeln('error'); this pair if we have on input n and p (Nc = 1 and Pc = 1) but still i have wa on 6 test! are there any conditions for "error" and "undefined"??? please help. i've already sent my solution for 13 times! and still it's wa... Oh, I have the same problem:( |
to Admins, about WA 3 | cupidon4uk [Lviv_NU] | 1823. Ideal Gas | 10 Sep 2012 00:21 | 3 |
Hi. I find out that test #3 looks like this : p = 3 V = 4 n = 0 When we need to find T, answer will be "undefined" if and only if n = 0 (because, in this way, we get division by zero). In second and in third tests n=0, and we need to find T. I wrote code like this : if( we need find T ) { if( n==0 ) printf("undefined\n"); } But, in this way, I get WA 3. What is wrong? Please, check test, or, if I made mistake, help me figure it out. Thanks. Edited by author 16.07.2012 01:48 the answer is "error" because there is no solution Edited by author 21.08.2012 15:16 But in this case I get WA 2, changing only one string in my code. |
n = 0 ? | RR | 1823. Ideal Gas | 22 Mar 2012 15:35 | 5 |
When n = 0, if we have to calculate T, is the answer 'undefined' ? if we have to calculate V, is the answer 'error' or 'undefined'? Accepted. Formula should be understood like math :) Edited by author 19.03.2011 19:58 Edited by author 19.03.2011 19:58 Re: n = 0 ? George_Aloyan[PTSObninsk] 29 Mar 2011 15:13 I don't understend what to do in this case. If we have any of t,v,n,p given to us <= 0 then we should write 'error'? Or I haven't understood the problem right? I just haven't read properly. If we have input p = 0 and n = 0 then we should output 'undefined'. If (p = 0 and n <> 0) or (p <> 0 and n = 0) then we should output 'error'. When we calculate n and p CAN be 0. We just must output '0'. When we calculate T and V CAN'T be 0. We just must output 'error'. I hope it'll help and you will not be sitting for hours as I did. Sorry for my English, but I think it is possible to understand what I meant even with my mistakes. |
WA3 | Oleksandr | 1823. Ideal Gas | 15 Jan 2012 05:26 | 2 |
WA3 Oleksandr 15 Jan 2012 05:25 if n or p or T or V not integer then error or some value? Edited by author 15.01.2012 05:32 Re: WA3 Oleksandr 15 Jan 2012 05:26 |
What is "error" and "undefined"? | IgorKoval(from Pskov) | 1823. Ideal Gas | 11 Oct 2011 20:31 | 1 |
error if : ( IsUsed[1] && V == 0 ) || ( IsUsed[3] && T == 0 ) || ( IsUsed[0] && IsUsed[2] && p*n==0 && ( p!=0 || n!=0 ) ) undefined if: ( IsUsed[0] && IsUsed[2] && p==0 && n==0 ) It's so hard! =) |
WA#6 | Valentin (PSU) | 1823. Ideal Gas | 5 Oct 2011 20:13 | 1 |
WA#6 Valentin (PSU) 5 Oct 2011 20:13 Print "p = ", but not "P = " And "n = ", but not "N = " |
WA 5: help me, this is my code | Soporboy Botirov [TUIT Urgench] | 1823. Ideal Gas | 10 Sep 2011 16:29 | 1 |
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class T_1823 { public static final double R = 8.314;
public static void main(String[] args) { Scanner in = new Scanner(System.in); Map<Character, Double> mp = new HashMap<Character, Double>(); for (int i = 1; i <=3; i++) { String s = in.nextLine().trim(); mp.put(s.charAt(0), (double)Integer.parseInt(s.charAt(4)+"")); } if(mp.get('T')!=null) { if(mp.get('T')==0) { System.out.println("error"); return; } } if(mp.get('V')!=null) { if(mp.get('V')==0) { System.out.println("error"); return; } } //System.out.println(mp); if(!mp.containsKey('p')) { double p = mp.get('n')*mp.get('T')*R/mp.get('V'); System.out.print("p = "); if(p==0) System.out.println(0); else System.out.printf("%.6f",p); } if(!mp.containsKey('n')) { double n = mp.get('p')*mp.get('V')/R*mp.get('T'); System.out.print("n = "); if(n==0) System.out.print(0); else System.out.printf("%.6f",n); } if(!mp.containsKey('T')) { if(mp.get('n')==0 && mp.get('p')!=0) { System.out.println("error"); } else { if(mp.get('n')==0 && mp.get('p')==0) { System.out.println("undefined"); } else { double T = mp.get('p')*mp.get('V')/R*mp.get('n'); if(T==0) { System.out.println("error"); } else { System.out.print("T = "); System.out.printf("%.6f",T); } } } } if(!mp.containsKey('V')) { if(mp.get('p')==0 && mp.get('n')!=0) { System.out.println("error"); } else { if(mp.get('n')==0 && mp.get('p')==0) { System.out.println("undefined"); } else { double V = mp.get('n')*R*mp.get('T')/mp.get('p'); if(V==0) { System.out.println("error"); } else { System.out.print("V = "); System.out.printf("%.6f",V); } } } } } } |
What is test 2 ? | ZARHANE | 1823. Ideal Gas | 27 Aug 2011 09:56 | 2 |
Help ! What is test case #2 ? Test 2: n=0 && p=0 should output: "undefined" |
wa4 | ASK | 1823. Ideal Gas | 23 Aug 2011 19:09 | 1 |
wa4 ASK 23 Aug 2011 19:09 V or T is calculated to be 0 => output error |
WA 13 | Vasily Slesarev | 1823. Ideal Gas | 30 Jun 2011 00:58 | 2 |
WA 13 Vasily Slesarev 29 Jun 2011 21:38 Please give test. (I already use printf instead of cout <<) Edited by author 29.06.2011 21:58 Edited by author 29.06.2011 21:58 I have found a mistake with computing p. Now AC. |
add test | [SESC USU] Efanov N. | 1823. Ideal Gas | 19 May 2011 14:04 | 2 |
add test [SESC USU] Efanov N. 19 May 2011 13:12 p = 1 t = 0 v = 1 i have AC but WA on this test "...It is guaranteed that the temperature and volume are positive..." (c) |
Test 3 | egor-belikov | 1823. Ideal Gas | 19 Mar 2011 19:08 | 2 |
Test 3 egor-belikov 19 Mar 2011 15:26 What is test 3? Can't find any mistakes, but WA#3. p=0 and n!=0 or otherwise |