結果
問題 |
No.432 占い(Easy)
|
ユーザー |
|
提出日時 | 2022-11-23 21:22:09 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 1,207 bytes |
コンパイル時間 | 1,825 ms |
コンパイル使用メモリ | 112,804 KB |
実行使用メモリ | 29,284 KB |
最終ジャッジ日時 | 2024-09-25 01:50:08 |
合計ジャッジ時間 | 2,676 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; using System.Collections.Generic; using System.Linq; using System.Numerics; using static System.Math; namespace SortItems { class Program { static void Main(string[] args) { var t = long.Parse(Console.ReadLine()); for (var i = 0; i < t; i++) { var s = Console.ReadLine().ToCharArray().Select(x => int.Parse(x.ToString())).ToList(); // 入力値が1桁の場合下記処理は不要 while (s.Count() > 1) { // 数値格納庫 var num = new List<int>(); for (var j = 0; j < s.Count() - 1; j++) { if (s[j] + s[j+1] >= 10) { num.Add((s[j] + s[j + 1]) % 10 + 1); } else { num.Add(s[j] + s[j + 1]); } } s = num; } Console.WriteLine(s.First()); } } } }