Submission #2123855
Source Code Expand
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author palayutm */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskA solver = new TaskA(); solver.solve(1, in, out); out.close(); } static class TaskA { public void solve(int testNumber, InputReader in, PrintWriter out) { int X = in.nextInt(), Y = in.nextInt(); if (X % Y == 0) out.println(-1); else out.println(X); } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } } }
Submission Info
Submission Time | |
---|---|
Task | A - Two Integers |
User | palayutm |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 1795 Byte |
Status | AC |
Exec Time | 73 ms |
Memory | 23380 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 73 ms | 21460 KB |
0_001.txt | AC | 69 ms | 19412 KB |
1_002.txt | AC | 70 ms | 19412 KB |
1_003.txt | AC | 70 ms | 21332 KB |
1_004.txt | AC | 71 ms | 20820 KB |
1_005.txt | AC | 70 ms | 21460 KB |
1_006.txt | AC | 70 ms | 21332 KB |
1_007.txt | AC | 70 ms | 21332 KB |
1_008.txt | AC | 71 ms | 19156 KB |
1_009.txt | AC | 68 ms | 18516 KB |
1_010.txt | AC | 71 ms | 20180 KB |
1_011.txt | AC | 69 ms | 19664 KB |
1_012.txt | AC | 71 ms | 18900 KB |
1_013.txt | AC | 69 ms | 19412 KB |
for_sample.txt | AC | 70 ms | 23380 KB |