結果
問題 | No.312 置換処理 |
ユーザー |
![]() |
提出日時 | 2016-10-29 17:47:28 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 2,077 ms |
コンパイル使用メモリ | 74,448 KB |
実行使用メモリ | 54,436 KB |
最終ジャッジ日時 | 2024-11-15 12:11:06 |
合計ジャッジ時間 | 9,062 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 45 |
ソースコード
import java.util.*;class B{static Scanner s = new Scanner(System.in);public static void main(String[] args) {long in = s.nextLong();if(in%3==0){System.out.println(3);return;}if(in%4==0){System.out.println(4);return;}if(in%2==0)in/=2;long l = (long)(Math.sqrt(in)+0.6);long c = 5;while(in%c!=0){c+=2;if(c>l){System.out.println(in);return;}}System.out.println(c);}}