結果
問題 | No.1519 Diversity |
ユーザー |
![]() |
提出日時 | 2021-05-28 21:17:16 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 273 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 4,816 ms |
コンパイル使用メモリ | 77,088 KB |
実行使用メモリ | 48,748 KB |
最終ジャッジ日時 | 2024-11-07 08:53:26 |
合計ジャッジ時間 | 7,068 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 |
ソースコード
import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); int n2 = n / 2; List<String> list = new ArrayList<>(); int x = n - 1; for (int i = 1; i <= n2; i++) { for (int j = 1; j <= x; j++) { list.add(i + " " + (i + j)); } x -= 2; } PrintWriter pw = new PrintWriter(System.out); pw.println(list.size()); for (String s : list) { pw.println(s); } pw.flush(); } }