結果

問題 No.443 GCD of Permutation
ユーザー dpforestdpforest
提出日時 2017-06-23 13:45:19
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 8,380 KB
最終ジャッジ日時 2023-07-26 17:21:49
合計ジャッジ時間 1,996 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
7,672 KB
testcase_02 AC 17 ms
7,800 KB
testcase_03 AC 15 ms
7,740 KB
testcase_04 AC 16 ms
7,912 KB
testcase_05 AC 15 ms
7,772 KB
testcase_06 AC 15 ms
7,744 KB
testcase_07 AC 16 ms
7,664 KB
testcase_08 AC 16 ms
7,800 KB
testcase_09 WA -
testcase_10 AC 16 ms
7,812 KB
testcase_11 WA -
testcase_12 AC 16 ms
7,800 KB
testcase_13 AC 16 ms
7,904 KB
testcase_14 AC 19 ms
8,204 KB
testcase_15 AC 17 ms
7,844 KB
testcase_16 AC 16 ms
7,736 KB
testcase_17 AC 16 ms
7,876 KB
testcase_18 AC 18 ms
8,252 KB
testcase_19 AC 17 ms
7,828 KB
testcase_20 AC 18 ms
8,380 KB
testcase_21 AC 17 ms
7,668 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 18 ms
8,196 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 18 ms
8,340 KB
testcase_29 WA -
testcase_30 AC 18 ms
8,208 KB
testcase_31 AC 18 ms
8,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

num = input()
digits = list(map(int, list(num)))
ans = 1

if all(d%8 == 0 for d in digits):
  ans *= 4
elif all(d%4 == 0 for d in digits):
  ans *= 4
elif all(d%2 == 0 for d in digits):
  ans *= 2

if sum(digits)%9 == 0:
  ans *= 9
elif sum(digits)%3 == 0:
  ans *= 3
  
if all(d%5 == 0 for d in digits):
  ans *= 5

if len(set(digits)) == 1:
  print(num)
else:
  print(ans)
0