結果
問題 |
No.432 占い(Easy)
|
ユーザー |
![]() |
提出日時 | 2018-09-16 13:58:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 1,113 bytes |
コンパイル時間 | 729 ms |
コンパイル使用メモリ | 113,996 KB |
実行使用メモリ | 19,200 KB |
最終ジャッジ日時 | 2024-07-18 07:23:10 |
合計ジャッジ時間 | 2,096 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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.IO; using System.Text; using System.Collections.Generic; using System.Linq; using System; public class Hello { public static void Main() { var sb = new StringBuilder(); var n = int.Parse(Console.ReadLine().Trim()); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); for (int i = 0; i < n; i++) sb.Append(getAns(Console.ReadLine().Trim())); Console.Write(sb); Console.Out.Flush(); } public static string 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); } return string.Format("{0}\n", a[0]); } }