結果

問題 No.434 占い
ユーザー 37zigen37zigen
提出日時 2020-04-04 04:01:36
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 776 bytes
コンパイル時間 2,057 ms
コンパイル使用メモリ 75,640 KB
実行使用メモリ 62,876 KB
最終ジャッジ日時 2023-09-16 05:18:32
合計ジャッジ時間 10,143 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,648 KB
testcase_01 AC 126 ms
56,172 KB
testcase_02 AC 124 ms
56,148 KB
testcase_03 AC 126 ms
55,916 KB
testcase_04 AC 121 ms
55,692 KB
testcase_05 AC 125 ms
55,700 KB
testcase_06 AC 217 ms
56,908 KB
testcase_07 AC 143 ms
55,720 KB
testcase_08 AC 540 ms
55,764 KB
testcase_09 AC 245 ms
57,508 KB
testcase_10 AC 198 ms
56,996 KB
testcase_11 AC 241 ms
57,192 KB
testcase_12 AC 318 ms
59,328 KB
testcase_13 AC 547 ms
55,588 KB
testcase_14 AC 241 ms
57,024 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int T=sc.nextInt();
		for(int t=0;t<T;++t) {
			ArrayDeque<Integer> dq=new ArrayDeque<>();
			char[] cs=sc.next().toCharArray();
			for(int i=0;i<cs.length;++i) {
				dq.addLast((int)(cs[i]-'0'));
			}
			while(dq.size()>1) {
				int n=dq.size();
				for(int i=0;i<n-1;++i) {
					int v=dq.pollFirst();
					int nv=v+dq.peekFirst();
					nv=nv%10+nv/10;
					dq.addLast(nv);
				}
				dq.pollFirst();
			}
			System.out.println(dq.poll());
		}
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}
0