結果

問題 No.933 おまわりさんこいつです
ユーザー poi_kyopropoi_kyopro
提出日時 2019-11-29 22:45:02
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,342 bytes
コンパイル時間 6,832 ms
コンパイル使用メモリ 74,300 KB
実行使用メモリ 69,904 KB
最終ジャッジ日時 2024-05-01 00:40:58
合計ジャッジ時間 15,204 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
54,208 KB
testcase_01 AC 128 ms
54,012 KB
testcase_02 AC 130 ms
54,144 KB
testcase_03 AC 116 ms
53,100 KB
testcase_04 AC 133 ms
54,280 KB
testcase_05 AC 132 ms
54,172 KB
testcase_06 AC 134 ms
54,224 KB
testcase_07 AC 135 ms
54,344 KB
testcase_08 AC 139 ms
54,396 KB
testcase_09 AC 138 ms
53,996 KB
testcase_10 AC 145 ms
54,180 KB
testcase_11 AC 163 ms
54,324 KB
testcase_12 AC 200 ms
56,608 KB
testcase_13 AC 310 ms
59,168 KB
testcase_14 AC 384 ms
59,624 KB
testcase_15 AC 538 ms
59,592 KB
testcase_16 AC 1,702 ms
69,904 KB
testcase_17 AC 576 ms
59,392 KB
testcase_18 AC 130 ms
54,296 KB
testcase_19 AC 691 ms
63,520 KB
testcase_20 AC 1,180 ms
69,360 KB
testcase_21 AC 130 ms
54,060 KB
testcase_22 AC 129 ms
54,140 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