結果

問題 No.432 占い(Easy)
ユーザー htensaihtensai
提出日時 2019-11-19 13:56:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 77,292 KB
実行使用メモリ 54,680 KB
最終ジャッジ日時 2024-04-14 09:25:58
合計ジャッジ時間 7,316 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
53,868 KB
testcase_01 AC 133 ms
54,040 KB
testcase_02 AC 135 ms
54,088 KB
testcase_03 AC 136 ms
54,048 KB
testcase_04 AC 135 ms
54,128 KB
testcase_05 AC 131 ms
54,192 KB
testcase_06 AC 144 ms
54,136 KB
testcase_07 AC 135 ms
54,036 KB
testcase_08 AC 135 ms
54,056 KB
testcase_09 AC 173 ms
53,968 KB
testcase_10 AC 140 ms
54,156 KB
testcase_11 AC 138 ms
54,152 KB
testcase_12 AC 152 ms
54,216 KB
testcase_13 AC 151 ms
54,412 KB
testcase_14 AC 139 ms
54,068 KB
testcase_15 AC 135 ms
54,136 KB
testcase_16 AC 135 ms
54,056 KB
testcase_17 AC 149 ms
53,976 KB
testcase_18 AC 168 ms
54,132 KB
testcase_19 AC 165 ms
54,132 KB
testcase_20 AC 142 ms
54,044 KB
testcase_21 AC 140 ms
54,120 KB
testcase_22 AC 141 ms
54,296 KB
testcase_23 AC 155 ms
54,116 KB
testcase_24 AC 179 ms
54,680 KB
testcase_25 AC 172 ms
54,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		int[][] arr = new int[t][];
		for (int i = 0; i < t; i++) {
		    String line = sc.next();
		    arr[i] = new int[line.length()];
		    for (int j = 0; j < line.length(); j++) {
		        arr[i][j] = line.charAt(j) - '0';
		    }
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < t; i++) {
		    for (int j = 0; j < arr[i].length - 1; j++) {
		        for (int k = 0; k < arr[i].length - j - 1; k++) {
		            int x = arr[i][k] + arr[i][k + 1];
		            arr[i][k] = x / 10 + x % 10;
		        }
		    }
		    sb.append(arr[i][0]).append("\n");
		}
		System.out.print(sb);
	}
}
0