結果

問題 No.2323 Nafmo、A+Bをする
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-10 22:42:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 882 bytes
コンパイル時間 1,119 ms
コンパイル使用メモリ 64,016 KB
実行使用メモリ 23,564 KB
最終ジャッジ日時 2023-10-10 22:42:56
合計ジャッジ時間 3,618 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,520 KB
testcase_01 AC 52 ms
19,392 KB
testcase_02 AC 56 ms
23,564 KB
testcase_03 AC 57 ms
21,564 KB
testcase_04 AC 53 ms
21,424 KB
testcase_05 AC 55 ms
21,476 KB
testcase_06 AC 53 ms
21,324 KB
testcase_07 AC 53 ms
21,336 KB
testcase_08 AC 53 ms
21,388 KB
testcase_09 AC 54 ms
23,276 KB
testcase_10 AC 56 ms
21,304 KB
testcase_11 AC 56 ms
21,392 KB
testcase_12 AC 58 ms
21,560 KB
testcase_13 AC 53 ms
21,428 KB
testcase_14 AC 56 ms
21,472 KB
testcase_15 AC 56 ms
21,612 KB
testcase_16 AC 56 ms
21,692 KB
testcase_17 AC 57 ms
23,564 KB
testcase_18 AC 53 ms
21,364 KB
testcase_19 AC 56 ms
21,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var a = ReadLine().ToList();
        var b = ReadLine().ToList();
        if (a.Count < b.Count) a = Enumerable.Repeat('0', b.Count - a.Count).Concat(a).ToList();
        if (a.Count > b.Count) b = Enumerable.Repeat('0', a.Count - b.Count).Concat(b).ToList();
        var ans = 0;
        for (var i = 0; i < a.Count; ++i)
        {
            ans = ans * 2 + (a[i] - '0') ^ (b[i] - '0');
        }
        WriteLine(ans);
    }
}
0