結果

問題 No.432 占い(Easy)
ユーザー naimonon77naimonon77
提出日時 2016-10-21 23:12:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 74,876 KB
実行使用メモリ 42,628 KB
最終ジャッジ日時 2024-05-02 22:03:29
合計ジャッジ時間 6,259 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
41,268 KB
testcase_01 AC 118 ms
41,020 KB
testcase_02 AC 102 ms
41,220 KB
testcase_03 AC 104 ms
40,888 KB
testcase_04 AC 116 ms
40,992 KB
testcase_05 AC 117 ms
41,296 KB
testcase_06 AC 130 ms
41,252 KB
testcase_07 AC 116 ms
41,084 KB
testcase_08 AC 129 ms
41,244 KB
testcase_09 AC 202 ms
42,580 KB
testcase_10 AC 131 ms
41,396 KB
testcase_11 AC 121 ms
41,376 KB
testcase_12 AC 123 ms
41,504 KB
testcase_13 AC 127 ms
41,116 KB
testcase_14 AC 117 ms
41,044 KB
testcase_15 AC 143 ms
41,044 KB
testcase_16 AC 108 ms
40,980 KB
testcase_17 AC 119 ms
41,616 KB
testcase_18 AC 142 ms
41,112 KB
testcase_19 AC 144 ms
41,256 KB
testcase_20 AC 121 ms
41,144 KB
testcase_21 AC 129 ms
40,996 KB
testcase_22 AC 149 ms
41,240 KB
testcase_23 AC 153 ms
41,640 KB
testcase_24 AC 202 ms
42,536 KB
testcase_25 AC 199 ms
42,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
       	for (int loop = 0; loop < T; loop++) {
			char[] str = sc.next().toCharArray();
			int[] s = new int[str.length];
			for (int i = 0; i < str.length; i++) s[i] = str[i] - '0';
			int N = s.length;
			while (N > 1) {
				for (int i = 0; i < N - 1; i++) {
					s[i] = s[i] + s[i+1];
					if (s[i] >= 10) s[i] = 1 + s[i] % 10;
				}
				N--;
			}
			System.out.println(s[0]);
       	}
	}
}
0