結果

問題 No.432 占い(Easy)
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-24 03:38:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 2,678 ms
コンパイル使用メモリ 77,076 KB
実行使用メモリ 48,560 KB
最終ジャッジ日時 2024-04-19 13:39:30
合計ジャッジ時間 7,868 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
42,676 KB
testcase_01 AC 109 ms
41,724 KB
testcase_02 AC 134 ms
42,436 KB
testcase_03 AC 148 ms
42,724 KB
testcase_04 AC 164 ms
43,456 KB
testcase_05 AC 130 ms
42,432 KB
testcase_06 AC 124 ms
41,628 KB
testcase_07 AC 155 ms
43,628 KB
testcase_08 AC 138 ms
42,872 KB
testcase_09 AC 184 ms
43,272 KB
testcase_10 AC 176 ms
43,364 KB
testcase_11 AC 207 ms
46,916 KB
testcase_12 AC 269 ms
48,556 KB
testcase_13 AC 278 ms
48,560 KB
testcase_14 AC 208 ms
46,844 KB
testcase_15 AC 142 ms
42,892 KB
testcase_16 AC 139 ms
42,996 KB
testcase_17 AC 290 ms
48,472 KB
testcase_18 AC 269 ms
48,488 KB
testcase_19 AC 247 ms
48,376 KB
testcase_20 AC 216 ms
46,716 KB
testcase_21 AC 208 ms
46,868 KB
testcase_22 AC 190 ms
43,704 KB
testcase_23 AC 188 ms
43,232 KB
testcase_24 AC 198 ms
43,388 KB
testcase_25 AC 182 ms
42,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		
		for (int i=0; i<n; i++) {
			String s = sc.next();
			String a = s;
			
			while (true) { //1桁になるまでループを回す
				if (a.length()==1) {break;}
				String b = "";
				
				for (int j=0; j<a.length()-1; j++) {
					
					int i1 = Integer.parseInt(a.substring(j,j+1));
					i1 += Integer.parseInt(a.substring(j+1,j+2));
					b += i1/10 + i1%10;
					
				}
				
				a = b;
			}
			
			out.println(a);
		}
	}
}
0