結果
問題 | No.933 おまわりさんこいつです |
ユーザー | poi_kyopro |
提出日時 | 2019-11-29 22:43:58 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,447 bytes |
コンパイル時間 | 2,015 ms |
コンパイル使用メモリ | 78,140 KB |
実行使用メモリ | 73,096 KB |
最終ジャッジ日時 | 2024-05-01 00:40:20 |
合計ジャッジ時間 | 11,109 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 98 ms
59,704 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 108 ms
54,156 KB |
testcase_04 | AC | 113 ms
54,012 KB |
testcase_05 | AC | 116 ms
54,296 KB |
testcase_06 | AC | 107 ms
53,108 KB |
testcase_07 | AC | 108 ms
53,140 KB |
testcase_08 | AC | 120 ms
54,368 KB |
testcase_09 | AC | 120 ms
54,224 KB |
testcase_10 | AC | 121 ms
53,996 KB |
testcase_11 | AC | 157 ms
54,348 KB |
testcase_12 | AC | 167 ms
54,252 KB |
testcase_13 | AC | 246 ms
59,224 KB |
testcase_14 | AC | 299 ms
59,040 KB |
testcase_15 | AC | 454 ms
59,856 KB |
testcase_16 | AC | 1,145 ms
69,752 KB |
testcase_17 | TLE | - |
testcase_18 | WA | - |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
ソースコード
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(); if(num % 3 == 0){ num = 3; } 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(); } }