結果
問題 |
No.432 占い(Easy)
|
ユーザー |
![]() |
提出日時 | 2018-09-16 13:51:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 843 bytes |
コンパイル時間 | 825 ms |
コンパイル使用メモリ | 105,472 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-07-18 07:23:03 |
合計ジャッジ時間 | 2,238 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic; using System.Linq; using System; public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); for (int i = 0; i < n; i++) getAns(Console.ReadLine().Trim()); } public static void getAns(string s) { var sL = s.Length; var a = new List<int>(); var b = new List<int>(); for (int i = 0; i < sL; i++) a.Add(int.Parse(s[i].ToString())); while (a.Count() > 1) { b.Clear(); for (int j = 0; j < a.Count() - 1; j++) { var w = a[j] + a[j + 1]; if (w >= 10) w -= 9; b.Add(w); } a.Clear(); foreach (var x in b) a.Add(x); } Console.WriteLine(a[0]); } }