Submission #1384896
Source Code Expand
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); if(N == 1){ System.out.println("Not Prime"); return; } boolean flag = true; for(int i = 2;i < N;i++){ if(N%i == 0){ flag = false; } } if(flag){ System.out.println("Prime"); return; } for(int i = 2;i*i <= N;i++){ if(N%i == 0){ if(N%10 != 2 && N%10 != 5){ int sum = 0; int n = N; while(n!=0){ sum += n%10; n /= 10; } if(sum%3 !=0){ System.out.println("Prime"); return; } } } } System.out.println("Not Prime"); } }
Submission Info
Submission Time | |
---|---|
Task | A - 素数判定 |
User | suesue |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1294 Byte |
Status | WA |
Exec Time | 2109 ms |
Memory | 23892 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 95 ms | 20820 KB |
sample_02.txt | AC | 96 ms | 21332 KB |
sample_03.txt | AC | 96 ms | 21844 KB |
sample_04.txt | AC | 96 ms | 21588 KB |
test_01.txt | AC | 93 ms | 21716 KB |
test_02.txt | AC | 96 ms | 17364 KB |
test_03.txt | WA | 95 ms | 23764 KB |
test_04.txt | AC | 95 ms | 18644 KB |
test_05.txt | AC | 97 ms | 19284 KB |
test_06.txt | WA | 98 ms | 21972 KB |
test_07.txt | AC | 93 ms | 19924 KB |
test_08.txt | WA | 96 ms | 21588 KB |
test_09.txt | TLE | 2109 ms | 22100 KB |
test_10.txt | WA | 108 ms | 21332 KB |
test_11.txt | AC | 102 ms | 20820 KB |
test_12.txt | AC | 95 ms | 18644 KB |
test_13.txt | AC | 135 ms | 19156 KB |
test_14.txt | AC | 127 ms | 19028 KB |
test_15.txt | TLE | 2109 ms | 21844 KB |
test_16.txt | AC | 95 ms | 18768 KB |
test_17.txt | AC | 96 ms | 19024 KB |
test_18.txt | AC | 94 ms | 21844 KB |
test_19.txt | AC | 455 ms | 20180 KB |
test_20.txt | AC | 461 ms | 19284 KB |
test_21.txt | AC | 598 ms | 19796 KB |
test_22.txt | WA | 492 ms | 19668 KB |
test_23.txt | TLE | 2109 ms | 23892 KB |
test_24.txt | AC | 423 ms | 18772 KB |
test_25.txt | AC | 229 ms | 21716 KB |
test_26.txt | AC | 101 ms | 20560 KB |
test_27.txt | AC | 95 ms | 18640 KB |
test_28.txt | AC | 951 ms | 21204 KB |
test_29.txt | AC | 1418 ms | 22228 KB |
test_30.txt | AC | 786 ms | 21204 KB |