結果

問題 No.432 占い(Easy)
ユーザー uafr_csuafr_cs
提出日時 2016-10-14 22:55:01
言語 Java19
(openjdk 21)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 72,184 KB
実行使用メモリ 59,088 KB
最終ジャッジ日時 2023-08-14 11:40:37
合計ジャッジ時間 7,147 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,768 KB
testcase_01 AC 123 ms
55,696 KB
testcase_02 AC 123 ms
55,812 KB
testcase_03 AC 124 ms
55,784 KB
testcase_04 AC 124 ms
55,764 KB
testcase_05 AC 124 ms
55,556 KB
testcase_06 AC 137 ms
55,892 KB
testcase_07 AC 122 ms
55,652 KB
testcase_08 AC 123 ms
55,984 KB
testcase_09 AC 216 ms
56,644 KB
testcase_10 AC 138 ms
55,364 KB
testcase_11 AC 127 ms
55,636 KB
testcase_12 AC 138 ms
55,624 KB
testcase_13 AC 139 ms
55,960 KB
testcase_14 AC 129 ms
55,724 KB
testcase_15 AC 126 ms
55,764 KB
testcase_16 AC 124 ms
55,636 KB
testcase_17 AC 140 ms
55,792 KB
testcase_18 AC 164 ms
56,104 KB
testcase_19 AC 161 ms
56,308 KB
testcase_20 AC 130 ms
55,716 KB
testcase_21 AC 129 ms
55,936 KB
testcase_22 AC 147 ms
55,836 KB
testcase_23 AC 162 ms
56,328 KB
testcase_24 AC 206 ms
59,088 KB
testcase_25 AC 215 ms
56,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int T = sc.nextInt();
		for(int tt = 0; tt < T; tt++){
			final char[] inputs = sc.next().toCharArray();
			
			int[] curr = new int[inputs.length];
			for(int i = 0; i < inputs.length; i++){
				curr[i] = Character.getNumericValue(inputs[i]);
			}
			
			for(int length = curr.length; length >= 1; length--){
				for(int i = 0; i < length - 1; i++){
					curr[i] = (curr[i] + curr[i + 1]) % 10 + (curr[i] + curr[i + 1]) / 10;
				}
			}
			
			System.out.println(curr[0]);
		}
		
	}

}
0