結果

問題 No.2086 A+B問題
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-08-09 15:43:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 1,025 ms
コンパイル使用メモリ 112,260 KB
実行使用メモリ 27,084 KB
最終ジャッジ日時 2024-04-27 10:32:31
合計ジャッジ時間 2,461 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
26,820 KB
testcase_01 AC 31 ms
26,992 KB
testcase_02 AC 30 ms
25,152 KB
testcase_03 AC 30 ms
24,904 KB
testcase_04 AC 31 ms
25,028 KB
testcase_05 AC 31 ms
26,992 KB
testcase_06 AC 31 ms
25,140 KB
testcase_07 AC 31 ms
27,076 KB
testcase_08 AC 31 ms
27,068 KB
testcase_09 AC 30 ms
24,692 KB
testcase_10 AC 29 ms
25,080 KB
testcase_11 AC 29 ms
24,696 KB
testcase_12 AC 29 ms
24,884 KB
testcase_13 AC 32 ms
25,080 KB
testcase_14 AC 30 ms
25,028 KB
testcase_15 AC 30 ms
24,824 KB
testcase_16 AC 31 ms
24,952 KB
testcase_17 AC 31 ms
24,700 KB
testcase_18 AC 31 ms
26,820 KB
testcase_19 AC 31 ms
27,084 KB
testcase_20 AC 30 ms
24,820 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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

namespace yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var n = new string[2];
            n[0] = Console.ReadLine();
            n[1] = Console.ReadLine();
            var m = n.OrderBy(x => x.Length).ToArray();
            var a = "";
            var s = 0;
            for(var i = 1; i <= m[1].Length; i++)
            {
                var j = m[0].Length - i >= 0 ? m[0][m[0].Length - i] - '0' : 0;
                var k = m[1][m[1].Length - i] - '0';
                a = ((j + k + s) % 10).ToString() + a;
                if (j + k + s >= 10)
                {
                    s = 1;
                }
                else
                {
                    s = 0;
                }
            }
            if (s == 1)
            {
                a = "1" + a;
            }
            Console.WriteLine(a);
        }
    }
}
0