結果

問題 No.443 GCD of Permutation
ユーザー dpforestdpforest
提出日時 2017-06-23 13:45:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-14 06:56:02
合計ジャッジ時間 2,393 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 32 ms
10,752 KB
testcase_11 WA -
testcase_12 AC 32 ms
10,752 KB
testcase_13 AC 31 ms
10,752 KB
testcase_14 AC 35 ms
10,880 KB
testcase_15 AC 32 ms
10,880 KB
testcase_16 AC 31 ms
10,752 KB
testcase_17 AC 32 ms
10,752 KB
testcase_18 AC 33 ms
10,880 KB
testcase_19 AC 32 ms
10,752 KB
testcase_20 AC 33 ms
10,880 KB
testcase_21 AC 32 ms
10,752 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 35 ms
11,008 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 35 ms
10,880 KB
testcase_29 WA -
testcase_30 AC 34 ms
10,880 KB
testcase_31 AC 33 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if all(d%8 == 0 for d in digits):
  ans *= 8
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