結果

問題 No.784 「,(カンマ)」
ユーザー bluemeganebluemegane
提出日時 2019-02-21 20:16:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 2,912 ms
コンパイル使用メモリ 104,284 KB
実行使用メモリ 24,516 KB
最終ジャッジ日時 2023-08-13 03:48:02
合計ジャッジ時間 3,638 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
20,404 KB
testcase_01 AC 51 ms
20,496 KB
testcase_02 AC 49 ms
20,416 KB
testcase_03 AC 50 ms
20,412 KB
testcase_04 AC 49 ms
22,500 KB
testcase_05 AC 50 ms
22,476 KB
testcase_06 AC 51 ms
22,452 KB
testcase_07 AC 50 ms
20,496 KB
testcase_08 AC 50 ms
24,516 KB
testcase_09 AC 51 ms
22,484 KB
testcase_10 AC 51 ms
20,508 KB
testcase_11 AC 49 ms
20,500 KB
testcase_12 AC 50 ms
20,360 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        if (s.Length <= 3) { Console.WriteLine(s); goto exit; }
        var a = s.Length % 3;
        if (a != 0 ) Console.Write(s.Substring(0, a) + ",");
        put3N(s.Substring(a));
        exit:;
    }
    static void put3N(string s)
    {
        var sL = s.Length;
        for (int i = 0; i < sL; i++)
        {
            Console.Write(s[i]);
            if (i % 3 == 2 && i != sL - 1) Console.Write(',');
        }
        Console.WriteLine();
    }
}

0