結果

問題 No.1519 Diversity
ユーザー bluemeganebluemegane
提出日時 2021-05-29 07:22:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 777 bytes
コンパイル時間 1,332 ms
コンパイル使用メモリ 105,984 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-04-25 07:25:24
合計ジャッジ時間 3,688 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
18,432 KB
testcase_01 AC 25 ms
18,560 KB
testcase_02 AC 26 ms
18,176 KB
testcase_03 AC 37 ms
21,248 KB
testcase_04 AC 52 ms
25,472 KB
testcase_05 AC 25 ms
18,432 KB
testcase_06 AC 60 ms
26,368 KB
testcase_07 AC 26 ms
18,688 KB
testcase_08 AC 29 ms
19,396 KB
testcase_09 AC 39 ms
21,632 KB
testcase_10 AC 50 ms
25,344 KB
testcase_11 AC 25 ms
18,560 KB
testcase_12 AC 58 ms
25,984 KB
testcase_13 AC 61 ms
26,368 KB
testcase_14 AC 61 ms
26,624 KB
testcase_15 AC 62 ms
26,496 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int a { get; set; }
    public int b { get; set; }
}

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        var ps = new List<P>();
        var imax = n / 2;
        var jmax = n;
        for (int i = 1; i <= imax; i++)
        {
            for (int j = i + 1; j <= jmax; j++) ps.Add(new P { a = i, b = j });
            jmax--;
        }
        Console.WriteLine(ps.Count());
        var sb = new StringBuilder();
        foreach (var x in ps)
            sb.Append(string.Format("{0} {1}\n", x.a, x.b));
        Console.Write(sb);
    }
}
0