結果

問題 No.312 置換処理
ユーザー mits58mits58
提出日時 2016-07-29 22:31:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 73,700 KB
実行使用メモリ 41,280 KB
最終ジャッジ日時 2024-04-24 12:22:52
合計ジャッジ時間 8,007 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
40,632 KB
testcase_01 AC 122 ms
41,104 KB
testcase_02 AC 113 ms
40,128 KB
testcase_03 AC 116 ms
40,220 KB
testcase_04 AC 114 ms
41,120 KB
testcase_05 AC 101 ms
39,944 KB
testcase_06 AC 108 ms
39,904 KB
testcase_07 AC 120 ms
40,552 KB
testcase_08 AC 110 ms
39,708 KB
testcase_09 AC 102 ms
39,936 KB
testcase_10 AC 111 ms
40,984 KB
testcase_11 AC 114 ms
40,948 KB
testcase_12 AC 111 ms
41,100 KB
testcase_13 AC 103 ms
40,152 KB
testcase_14 AC 97 ms
39,524 KB
testcase_15 AC 113 ms
41,104 KB
testcase_16 AC 113 ms
41,128 KB
testcase_17 AC 113 ms
40,876 KB
testcase_18 AC 103 ms
40,304 KB
testcase_19 AC 110 ms
40,788 KB
testcase_20 AC 95 ms
39,740 KB
testcase_21 AC 108 ms
40,752 KB
testcase_22 AC 107 ms
40,968 KB
testcase_23 WA -
testcase_24 AC 114 ms
40,936 KB
testcase_25 AC 115 ms
40,984 KB
testcase_26 AC 114 ms
39,936 KB
testcase_27 AC 106 ms
40,628 KB
testcase_28 AC 107 ms
39,512 KB
testcase_29 AC 116 ms
40,520 KB
testcase_30 AC 107 ms
40,200 KB
testcase_31 AC 110 ms
41,100 KB
testcase_32 AC 118 ms
40,832 KB
testcase_33 AC 117 ms
41,280 KB
testcase_34 AC 114 ms
39,920 KB
testcase_35 AC 105 ms
39,924 KB
testcase_36 AC 113 ms
40,984 KB
testcase_37 AC 112 ms
41,168 KB
testcase_38 AC 108 ms
41,052 KB
testcase_39 AC 96 ms
39,792 KB
testcase_40 AC 112 ms
41,072 KB
testcase_41 AC 111 ms
40,848 KB
testcase_42 AC 114 ms
41,068 KB
testcase_43 AC 115 ms
40,992 KB
testcase_44 AC 116 ms
39,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	static boolean isprime(long x){
		if(x==1) return false;
		for(long i=2;i*i<=x;i++) if(x%i==0) return false;
		return true;
	}
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			long n=sc.nextLong();
			if(isprime(n)) System.out.println(n);
			else{
				boolean flag=true;
				for(long i=3;i*i<=n;i++){
					if(n%i==0){
						System.out.println(i);
						flag=false;
						break;
					}
				}
				if(flag) System.out.println(n/2);
			}
		}
	}
}
0