結果

問題 No.9000 Hello World! (テスト用)
ユーザー くれちーくれちー
提出日時 2017-10-09 12:53:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 1,049 bytes
コンパイル時間 2,116 ms
コンパイル使用メモリ 108,416 KB
実行使用メモリ 22,472 KB
最終ジャッジ日時 2023-08-26 16:19:48
合計ジャッジ時間 2,802 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
20,336 KB
testcase_01 AC 40 ms
18,440 KB
testcase_02 AC 41 ms
22,472 KB
testcase_03 AC 40 ms
20,332 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Hoge
{
    private string _helloWorld;
    private char _suffix = '!';

    public string HelloWorld
    {
        get => _helloWorld;
        set => _helloWorld = value ?? throw new ArgumentNullException();
    }

    public string TryGetHelloWorld(out string str)
        => str = (this.HelloWorld is string helloWorld) ? helloWorld : "";

    public ref char GetSuffix() => ref _suffix;
}

class Program
{
    public static void Main()
    {
        (string helloWorld, int, char suffix, double) HelloWorld()
        {
            var hoge = new Hoge() { HelloWorld = "Hello World" };
            var suffix = hoge.GetSuffix();

            switch (hoge)
            {
                case object hogeObj:
                {
                    ((Hoge)hogeObj).TryGetHelloWorld(out var helloWorld);
                    return (helloWorld, 114514, suffix, Math.PI);
                }
            }

            throw new Exception();
        }

        var (h, _, s, _) = HelloWorld();
        Console.WriteLine(h + s);
    }
}
0