Submission #29449120
Source Code Expand
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Main {
static FastScanner sc = new FastScanner();
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static void solve(){
HashSet<Integer>prime = new HashSet<>();
prime.add(1);
for(int i = 2;i <= 250;i++){
boolean valid = true;
for(int j = 2;j < i;j++){
if(i % j == 0){
valid= false;
}
}
if(valid){
prime.add(i);
}
}
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
for(int i = a;i <= b;i++){
boolean p = false;
for(int j = c;j <= d;j++){
if(prime.contains(i + j)){
p = true;
break;
}
}
if(!p){
System.out.println("Takahashi");
return;
}
}
System.out.println("Aoki");
}
public static void main(String[] args) {
int n = 1;
for(int i = 0;i < n;i++){
solve();
}
out.flush();
}
static class FastScanner {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Prime Sum Game |
| User | liuji |
| Language | Java (OpenJDK 11.0.6) |
| Score | 400 |
| Code Size | 2171 Byte |
| Status | AC |
| Exec Time | 79 ms |
| Memory | 32824 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand_01.txt | AC | 72 ms | 32416 KiB |
| hand_02.txt | AC | 69 ms | 32572 KiB |
| hand_03.txt | AC | 70 ms | 32648 KiB |
| random_01.txt | AC | 69 ms | 32236 KiB |
| random_02.txt | AC | 68 ms | 32552 KiB |
| random_03.txt | AC | 67 ms | 32328 KiB |
| random_04.txt | AC | 77 ms | 32540 KiB |
| random_05.txt | AC | 77 ms | 32520 KiB |
| random_06.txt | AC | 75 ms | 32556 KiB |
| random_07.txt | AC | 74 ms | 32584 KiB |
| random_08.txt | AC | 71 ms | 32532 KiB |
| random_09.txt | AC | 70 ms | 32048 KiB |
| random_10.txt | AC | 78 ms | 32576 KiB |
| random_11.txt | AC | 68 ms | 32672 KiB |
| random_12.txt | AC | 79 ms | 32560 KiB |
| random_13.txt | AC | 75 ms | 32616 KiB |
| random_14.txt | AC | 74 ms | 32472 KiB |
| random_15.txt | AC | 77 ms | 32624 KiB |
| random_16.txt | AC | 75 ms | 32704 KiB |
| random_17.txt | AC | 69 ms | 32512 KiB |
| random_18.txt | AC | 69 ms | 32508 KiB |
| random_19.txt | AC | 67 ms | 32520 KiB |
| random_20.txt | AC | 79 ms | 32824 KiB |
| random_21.txt | AC | 67 ms | 32104 KiB |
| random_22.txt | AC | 68 ms | 32188 KiB |
| random_23.txt | AC | 77 ms | 32584 KiB |
| random_24.txt | AC | 70 ms | 32488 KiB |
| random_25.txt | AC | 71 ms | 32632 KiB |
| random_26.txt | AC | 71 ms | 32292 KiB |
| random_27.txt | AC | 75 ms | 32628 KiB |
| sample_01.txt | AC | 75 ms | 32696 KiB |
| sample_02.txt | AC | 74 ms | 32652 KiB |
| sample_03.txt | AC | 76 ms | 32492 KiB |