結果

問題 No.432 占い(Easy)
ユーザー tsuchinagatsuchinaga
提出日時 2019-02-28 23:04:16
言語 Go
(1.22.1)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 10,396 ms
コンパイル使用メモリ 210,172 KB
実行使用メモリ 8,856 KB
最終ジャッジ日時 2023-09-05 16:22:58
合計ジャッジ時間 11,929 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 7 ms
5,612 KB
testcase_12 AC 72 ms
8,852 KB
testcase_13 AC 74 ms
8,856 KB
testcase_14 AC 7 ms
5,612 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 72 ms
8,856 KB
testcase_18 AC 32 ms
8,716 KB
testcase_19 AC 21 ms
8,620 KB
testcase_20 AC 10 ms
8,104 KB
testcase_21 AC 12 ms
8,216 KB
testcase_22 AC 4 ms
4,380 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 6 ms
4,376 KB
testcase_25 AC 6 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var t int
	_, _ = fmt.Scan(&t)

	s := ""
	for i := 0; i < t; i++ {
		_, _ = fmt.Scan(&s)
		for {
			if len(s) == 1 {
				fmt.Println(s)
				break
			}

			t := ""
			for j := 0; j < len(s)-1; j++ {
				a, _ := strconv.Atoi(string(s[j]))
				b, _ := strconv.Atoi(string(s[j+1]))
				a += b
				for {
					if a < 10 {
						break
					}
					a = a/10 + a%10
				}
				t += strconv.Itoa(a)
			}
			s = t
		}
	}
}
0