Task: | Pinta-ala |
Sender: | Septicuss |
Submission time: | 2023-01-21 16:59:59 +0200 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.12 s | details |
#2 | WRONG ANSWER | 0.12 s | details |
#3 | WRONG ANSWER | 0.11 s | details |
Code
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; public class B { final static FastReader reader = new FastReader(); final static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) { B clazz = new B(); int t = reader.nextInt(); for (int i = 0; i < t; i++) writer.println(clazz.solve(reader.nextInt(), reader.nextInt()) ? "YES" : "NO"); reader.close(); writer.flush(); writer.close(); } boolean solve(int A, int B) { double sqrtA = Math.sqrt(A); double sqrtB = Math.sqrt(B) - 1; return (Math.floor(sqrtB) == Math.floor(sqrtA)); } static class FastReader { BufferedReader reader; StringTokenizer tokenizer; public FastReader() { this.reader = new BufferedReader(new InputStreamReader(System.in)); this.tokenizer = null; } String next() { while (tokenizer == null || !tokenizer.hasMoreElements()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (Exception e) { } } return tokenizer.nextToken(); } String nextLine() { try { return reader.readLine(); } catch (IOException ex) { } return null; } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } BigInteger nextBigInt() { return new BigInteger(next()); } void close() { try { reader.close(); } catch (IOException ex) { } reader = null; tokenizer = null; } } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1000 578049 731905 262997 434601 559974 650052 458543 101143 ... |
correct output |
---|
YES YES YES NO NO ... |
user output |
---|
NO NO NO NO NO ... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
1000 10000 9500 10000 9501 10000 9502 10000 9503 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO NO ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
961 1 1 1 2 1 3 1 4 ... |
correct output |
---|
NO NO NO YES YES ... |
user output |
---|
NO NO NO YES YES ... Truncated |