結果
問題 | No.237 作図可能性 |
ユーザー |
![]() |
提出日時 | 2016-12-03 17:50:16 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 126 ms / 2,000 ms |
コード長 | 954 bytes |
コンパイル時間 | 2,314 ms |
コンパイル使用メモリ | 77,904 KB |
実行使用メモリ | 53,984 KB |
最終ジャッジ日時 | 2024-11-27 18:03:13 |
合計ジャッジ時間 | 7,643 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long [] F = {3L,5L,17L,257L,65537L}; long [] m = new long [30]; for(int i=0; i<30; i++){ m[i]=(long)Math.pow(2,i); } ArrayList<Long> Fpr = new ArrayList<Long>(); Fpr.add(1L); for(int i=0; i<5; i++){ int L=Fpr.size(); for(int j=0; j<L; j++){ Fpr.add(Fpr.get(j)*F[i]); } } ArrayList<Long> array = new ArrayList<Long>(); for(int i=0; i<30; i++){ for(int j=0; j<Fpr.size(); j++){ array.add(Fpr.get(j)*m[i]); } } int c=0; for(int j=0; j<array.size(); j++){ if(3<=array.get(j)&&array.get(j)<=N){ c++; } } System.out.println(c); } }