|
|
back to boardPlease help me! Posted by Cody 15 Mar 2009 14:36 Why WA on 5 test? the code here: int type = in.nextInt(); int size = in.nextInt(); int n = in.nextInt(); int count = 0; for (int i = 0; i < n; i++) { int curType = in.nextInt(); int curSize = in.nextInt();
if (type == 1) { if (curType == 1 && curSize <= size || curType != 1 && curSize <= 2 * size) { count++; } } if (type == 2) { if (curType == 1 && 2 * curSize <= size* Math.sqrt(2) || curType != 1&&curSize <= size * Math.sqrt(2)) { count++; } } if (type == 3) { if (curType == 1 && 2 * curSize <= size || curType != 1&&curSize <= size) { count++; } } } out.print(count); |
|
|