結果

問題 No.432 占い(Easy)
ユーザー hermione17
提出日時 2016-10-14 22:40:45
言語 Java
(openjdk 23)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 6,858 ms
コンパイル使用メモリ 74,360 KB
実行使用メモリ 42,712 KB
最終ジャッジ日時 2024-11-22 07:41:13
合計ジャッジ時間 8,784 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintStream;
import java.util.Scanner;


public class Y432 {
	Y432() throws Exception {
		Scanner in = new Scanner(System.in);
		PrintStream out = new PrintStream(System.out);
		
		int t = in.nextInt();
		
		for (int tt = 0; tt < t; tt++) {
			char[] s = in.next().toCharArray();
			int n = s.length;
			for (int i=n; i>1; i--) {
				for (int j=0; j < i - 1; j++) {
					int g = (int)s[j] - (int)'0' + (int)s[j+1] - (int)'0';
					g = g / 10 + g % 10;
					s[j] = (char)(g + '0');
				}
			}
			out.println(s[0]);
		}

	}

	public static void main(String argv[]) throws Exception {
		new Y432();
	}
}
0