結果

問題 No.9000 Hello World! (テスト用)
ユーザー くれちーくれちー
提出日時 2017-10-09 12:47:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 853 bytes
コンパイル時間 2,256 ms
コンパイル使用メモリ 102,364 KB
実行使用メモリ 22,504 KB
最終ジャッジ日時 2023-08-26 16:19:42
合計ジャッジ時間 2,973 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
22,312 KB
testcase_01 AC 46 ms
20,452 KB
testcase_02 AC 46 ms
20,496 KB
testcase_03 AC 46 ms
22,504 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()
    {
        var hoge = new Hoge() { HelloWorld = "Hello World" };
        var suffix = hoge.GetSuffix();

        switch (hoge)
        {
            case object hogeObj:
            {
                ((Hoge)hogeObj).TryGetHelloWorld(out var helloWorld);
                Console.Write(helloWorld);
                Console.Write(suffix);
                break;
            }
        }
    }
}
0