結果
問題 | No.690 E869120 and Constructing Array 4 |
ユーザー | tenten |
提出日時 | 2021-03-02 19:21:23 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 153 ms / 1,000 ms |
コード長 | 1,083 bytes |
コンパイル時間 | 2,857 ms |
コンパイル使用メモリ | 78,572 KB |
実行使用メモリ | 54,772 KB |
最終ジャッジ日時 | 2024-04-14 04:48:24 |
合計ジャッジ時間 | 6,899 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 153 ms
53,976 KB |
testcase_01 | AC | 142 ms
54,260 KB |
testcase_02 | AC | 140 ms
54,272 KB |
testcase_03 | AC | 142 ms
54,056 KB |
testcase_04 | AC | 138 ms
54,324 KB |
testcase_05 | AC | 141 ms
53,932 KB |
testcase_06 | AC | 143 ms
54,448 KB |
testcase_07 | AC | 142 ms
54,032 KB |
testcase_08 | AC | 148 ms
53,892 KB |
testcase_09 | AC | 144 ms
54,372 KB |
testcase_10 | AC | 140 ms
54,196 KB |
testcase_11 | AC | 144 ms
53,988 KB |
testcase_12 | AC | 149 ms
54,772 KB |
testcase_13 | AC | 147 ms
54,276 KB |
testcase_14 | AC | 142 ms
54,344 KB |
testcase_15 | AC | 144 ms
53,796 KB |
testcase_16 | AC | 147 ms
54,168 KB |
testcase_17 | AC | 146 ms
54,124 KB |
testcase_18 | AC | 149 ms
54,432 KB |
testcase_19 | AC | 150 ms
54,236 KB |
testcase_20 | AC | 143 ms
54,076 KB |
testcase_21 | AC | 143 ms
54,112 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); ArrayList<Path> ans = new ArrayList<>(); for (int i = 1; i <= 30; i++) { for (int j = i + 1; j <= 31; j++) { ans.add(new Path(i, j)); } } for (int i = 29; i >= 0; i--) { if (k >= (1 << i)) { ans.add(new Path(i + 2, 32)); k -= (1 << i); } } StringBuilder sb = new StringBuilder(); sb.append("32 ").append(ans.size()).append("\n"); for (Path p : ans) { sb.append(p).append("\n"); } System.out.print(sb); } static class Path { int from; int to; public Path(int from, int to) { this.from = from; this.to = to; } public String toString() { return new StringBuilder().append(from).append(" ").append(to).toString(); } } }