結果

問題 No.933 おまわりさんこいつです
ユーザー poi_kyopropoi_kyopro
提出日時 2019-11-29 22:29:50
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,365 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 75,208 KB
実行使用メモリ 76,408 KB
最終ジャッジ日時 2024-05-01 00:37:09
合計ジャッジ時間 14,023 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
61,180 KB
testcase_01 AC 133 ms
54,336 KB
testcase_02 AC 134 ms
54,280 KB
testcase_03 AC 135 ms
53,828 KB
testcase_04 AC 134 ms
54,220 KB
testcase_05 AC 136 ms
54,264 KB
testcase_06 AC 143 ms
54,444 KB
testcase_07 AC 135 ms
53,160 KB
testcase_08 AC 145 ms
54,396 KB
testcase_09 AC 146 ms
53,880 KB
testcase_10 AC 145 ms
54,144 KB
testcase_11 AC 168 ms
54,452 KB
testcase_12 AC 209 ms
56,764 KB
testcase_13 AC 312 ms
59,336 KB
testcase_14 AC 406 ms
59,304 KB
testcase_15 AC 561 ms
59,360 KB
testcase_16 AC 1,658 ms
69,908 KB
testcase_17 AC 582 ms
59,520 KB
testcase_18 AC 132 ms
54,372 KB
testcase_19 AC 692 ms
61,264 KB
testcase_20 AC 1,238 ms
69,652 KB
testcase_21 AC 132 ms
54,232 KB
testcase_22 AC 131 ms
54,104 KB
testcase_23 TLE -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.math.BigInteger;

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();
        BigInteger sum = BigInteger.valueOf(1);
        //boolean flag = true;
        
        for(int i = 0; i < n; i++){
            long num = stdIn.nextLong();
            sum = sum.multiply(BigInteger.valueOf(num));
        }
        
        long ans = 0;
        
        for(int j = 0; j < 1; j++){
            String s = String.valueOf(sum);
            char c[] = s.toCharArray();
            
            
            
            for(int i = 0; i < s.length(); i++){
                ans += c[i] - 48;
            }
        }
        
        while(true){
            String s = String.valueOf(ans);
            char c[] = s.toCharArray();
            
            ans = 0;
            
            for(int i = 0; i < s.length(); i++){
                ans += c[i] - 48;
            }
            
            if(ans <= 9){
                break;
            }
        }
        

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