結果
問題 | No.688 E869120 and Constructing Array 2 |
ユーザー |
![]() |
提出日時 | 2020-09-03 20:08:39 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 883 bytes |
コンパイル時間 | 5,142 ms |
コンパイル使用メモリ | 85,824 KB |
実行使用メモリ | 41,440 KB |
最終ジャッジ日時 | 2024-11-24 00:03:28 |
合計ジャッジ時間 | 6,861 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int zero = 0; int one = 0; HashMap<Integer, Integer> makeOne = new HashMap<>(); for (int i = 2; i <= 30; i++) { makeOne.put(i * (i - 1) / 2, i); } for (int i = 0; i <= 28; i++) { zero = i; if (k % (1 << i) == 0) { int tmp = k / (1 << i); if (makeOne.containsKey(tmp)) { one = makeOne.get(tmp); break; } } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < one; i++) { if (i > 0) { sb.append(" "); } sb.append(1); } for (int j = 0; j < zero; j++) { sb.append(" 0"); } System.out.println(sb); } }