結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2016-12-12 15:29:16 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 157 ms / 2,000 ms |
コード長 | 1,032 bytes |
コンパイル時間 | 2,096 ms |
コンパイル使用メモリ | 103,936 KB |
実行使用メモリ | 21,760 KB |
最終ジャッジ日時 | 2024-11-29 16:00:08 |
合計ジャッジ時間 | 3,317 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; namespace Yukicoder { public class Program { public static void Main() { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string num = Console.ReadLine(); Solve(num); } } private static void Solve(string num) { string tmp = num; string ans = ""; int len = tmp.Length; while (len > 1) { for (int i = 1; i < len; i++) { int x = GetInt(tmp[i], tmp[i - 1]); string str = x.ToString(); ans += x > 9 ? GetInt(str[0],str[1]).ToString() : str; } tmp = ans; ans = ""; len--; } Console.WriteLine(tmp); } private static int GetInt(char v1, char v2) { return (v1 - '0') + (v2 - '0'); } } }