結果
問題 |
No.933 おまわりさんこいつです
|
ユーザー |
|
提出日時 | 2020-10-13 20:20:26 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 933 bytes |
コンパイル時間 | 3,644 ms |
コンパイル使用メモリ | 81,012 KB |
実行使用メモリ | 72,800 KB |
最終ジャッジ日時 | 2024-07-20 18:46:33 |
合計ジャッジ時間 | 10,704 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 14 RE * 3 |
ソースコード
import java.util.*; public class SSd { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine().trim()); String ar[] = sc.nextLine().split(" "); long mul = 1; long nums[] = new long[n]; for(int i=0;i<n;i++){ int cur = Integer.parseInt(ar[i]); if(cur == 0){ mul = 0; break; }else{ nums[i] = cur; } } if(mul == 0) System.out.println("0"); else{ for(long i:nums) mul *= i; while(mul >= 10){ mul = getSum(mul); } System.out.println(mul); } } static long getSum(long n){ long sum = 0; while(n!=0){ sum += n%10; n /= 10; } return sum; } }