結果

問題 No.933 おまわりさんこいつです
ユーザー poi_kyopro
提出日時 2019-11-29 21:58:22
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 940 bytes
コンパイル時間 2,856 ms
コンパイル使用メモリ 73,968 KB
実行使用メモリ 49,136 KB
最終ジャッジ日時 2024-11-20 22:11:21
合計ジャッジ時間 8,777 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 14 RE * 3
権限があれば一括ダウンロードができます

ソースコード

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