結果

問題 No.933 おまわりさんこいつです
ユーザー Mishan5055Mishan5055
提出日時 2020-02-26 18:07:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 687 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 75,200 KB
実行使用メモリ 49,200 KB
最終ジャッジ日時 2024-04-21 16:31:18
合計ジャッジ時間 9,767 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,244 KB
testcase_01 AC 131 ms
41,172 KB
testcase_02 AC 131 ms
41,152 KB
testcase_03 AC 136 ms
41,420 KB
testcase_04 AC 132 ms
41,224 KB
testcase_05 AC 134 ms
41,252 KB
testcase_06 AC 137 ms
41,276 KB
testcase_07 AC 140 ms
41,084 KB
testcase_08 AC 140 ms
41,528 KB
testcase_09 AC 142 ms
41,364 KB
testcase_10 AC 140 ms
41,800 KB
testcase_11 AC 154 ms
41,832 KB
testcase_12 AC 171 ms
42,076 KB
testcase_13 AC 194 ms
43,156 KB
testcase_14 AC 206 ms
44,008 KB
testcase_15 AC 233 ms
46,212 KB
testcase_16 AC 346 ms
47,668 KB
testcase_17 AC 506 ms
48,116 KB
testcase_18 AC 132 ms
41,288 KB
testcase_19 AC 541 ms
49,200 KB
testcase_20 AC 490 ms
48,060 KB
testcase_21 AC 134 ms
41,244 KB
testcase_22 AC 130 ms
41,116 KB
testcase_23 AC 667 ms
48,380 KB
testcase_24 AC 687 ms
48,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main{
	public static int transform(String txt) {
		int len=txt.length();
		int Ans=0;
		for(int i=0;i<len;i++) {
			Ans+=Character.getNumericValue(txt.charAt(i));
		}
		if(Ans<10) {
			return Ans;
		}else {
			String txt2=String.valueOf(Ans);
			return transform(txt2);
		}
	}
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int ANS=1;
		for(int i=0;i<N;i++) {
			String Kstr=scan.next();
			int K=transform(Kstr);
			ANS*=K;
			String ANSstr=String.valueOf(ANS);
			ANS=transform(ANSstr);
		}
		
		System.out.println(ANS);
	}
}
0