結果

問題 No.933 おまわりさんこいつです
ユーザー poi_kyopropoi_kyopro
提出日時 2019-11-29 21:58:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 940 bytes
コンパイル時間 2,138 ms
コンパイル使用メモリ 74,456 KB
実行使用メモリ 59,164 KB
最終ジャッジ日時 2024-04-30 23:32:18
合計ジャッジ時間 8,687 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
54,116 KB
testcase_01 AC 135 ms
54,064 KB
testcase_02 AC 134 ms
54,128 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 140 ms
53,996 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 566 ms
48,800 KB
testcase_18 AC 131 ms
41,164 KB
testcase_19 AC 601 ms
48,852 KB
testcase_20 WA -
testcase_21 AC 132 ms
41,432 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int n = stdIn.nextInt();
        //int b = stdIn.nextInt();
        long p[] = new long[n];
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        long sum = 1;
        //boolean flag = true;
        
        for(int i = 0; i < n; i++){
            sum *= stdIn.nextInt();
        }
        
        while(true){
            String s = String.valueOf(sum);
            char c[] = s.toCharArray();
            
            sum = 0;
            
            for(int i = 0; i < s.length(); i++){
                sum += c[i] - 48;
            }
            
            if(sum <= 9){
                break;
            }
        }
        

        
        System.out.println(sum);
        
        //System.out.println();
        //System.out.print();
    }
}
0