結果
問題 |
No.1183 コイン遊び
|
ユーザー |
![]() |
提出日時 | 2020-12-31 21:46:41 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 647 ms / 2,000 ms |
コード長 | 829 bytes |
コンパイル時間 | 1,068 ms |
コンパイル使用メモリ | 113,252 KB |
実行使用メモリ | 116,260 KB |
最終ジャッジ日時 | 2024-10-09 21:05:39 |
合計ジャッジ時間 | 18,513 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; public static class P { public static void Main() { int n = int.Parse(Console.ReadLine()); var a = Console.ReadLine().Split().Select(int.Parse).ToArray(); var b = Console.ReadLine().Split().Select(int.Parse).ToArray(); var diff = a.Zip(b, (x, y) => x ^ y).ToArray(); int last = 0; int res = 0; for (int i = 0; i < n; i++) { if (last != diff[i] && last == 1) res++; last = diff[i]; } if (last == 1) res++; Console.WriteLine(res); } }