結果
問題 | No.933 おまわりさんこいつです |
ユーザー | Nitish Songara |
提出日時 | 2020-10-13 20:20:26 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 933 bytes |
コンパイル時間 | 3,714 ms |
コンパイル使用メモリ | 72,212 KB |
実行使用メモリ | 61,040 KB |
最終ジャッジ日時 | 2023-09-28 00:17:00 |
合計ジャッジ時間 | 9,629 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 105 ms
39,088 KB |
testcase_01 | AC | 107 ms
39,600 KB |
testcase_02 | AC | 105 ms
39,304 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 111 ms
39,320 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 | 281 ms
49,864 KB |
testcase_18 | AC | 103 ms
39,408 KB |
testcase_19 | AC | 361 ms
55,520 KB |
testcase_20 | WA | - |
testcase_21 | AC | 103 ms
39,572 KB |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
ソースコード
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; } }