結果
問題 |
No.680 作れる数
|
ユーザー |
![]() |
提出日時 | 2020-01-15 20:50:28 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 624 bytes |
コンパイル時間 | 2,102 ms |
コンパイル使用メモリ | 74,196 KB |
実行使用メモリ | 54,176 KB |
最終ジャッジ日時 | 2024-06-11 19:45:47 |
合計ジャッジ時間 | 15,533 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 1 TLE * 1 |
ソースコード
import java.util.*; public class Main { static int n; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); if (calc(0, 1)) { System.out.println("YES"); } else { System.out.println("NO"); } } static boolean calc(int s, int t) { s += t; if (s == n) { return true; } else if (s > n) { return false; } t *= 2; if (calc(s, t)) { return true; } else { return calc(s, t + 1); } } }