結果

問題 No.1185 完全な3の倍数
ユーザー marroncastlemarroncastle
提出日時 2020-08-22 14:39:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,350 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 441,964 KB
最終ジャッジ日時 2023-08-16 00:08:35
合計ジャッジ時間 14,076 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 370 ms
187,796 KB
testcase_01 AC 97 ms
71,836 KB
testcase_02 AC 101 ms
71,388 KB
testcase_03 AC 368 ms
187,628 KB
testcase_04 AC 367 ms
187,676 KB
testcase_05 AC 370 ms
187,716 KB
testcase_06 AC 369 ms
187,964 KB
testcase_07 AC 372 ms
187,860 KB
testcase_08 AC 1,350 ms
441,964 KB
testcase_09 AC 157 ms
71,684 KB
testcase_10 AC 102 ms
71,428 KB
testcase_11 AC 99 ms
71,384 KB
testcase_12 AC 96 ms
71,524 KB
testcase_13 AC 97 ms
71,856 KB
testcase_14 AC 96 ms
71,748 KB
testcase_15 AC 96 ms
71,792 KB
testcase_16 AC 95 ms
71,388 KB
testcase_17 AC 95 ms
71,528 KB
testcase_18 AC 95 ms
71,684 KB
testcase_19 AC 373 ms
187,552 KB
testcase_20 AC 370 ms
187,720 KB
testcase_21 AC 370 ms
187,732 KB
testcase_22 AC 380 ms
187,808 KB
testcase_23 AC 369 ms
187,580 KB
testcase_24 AC 368 ms
187,624 KB
testcase_25 AC 173 ms
97,204 KB
testcase_26 AC 375 ms
187,584 KB
testcase_27 AC 376 ms
187,412 KB
testcase_28 AC 375 ms
187,480 KB
testcase_29 AC 371 ms
187,836 KB
testcase_30 AC 374 ms
187,620 KB
testcase_31 AC 116 ms
77,752 KB
testcase_32 AC 374 ms
187,720 KB
testcase_33 AC 173 ms
97,076 KB
testcase_34 AC 371 ms
187,524 KB
testcase_35 AC 369 ms
187,756 KB
testcase_36 AC 371 ms
187,760 KB
testcase_37 AC 371 ms
187,732 KB
testcase_38 AC 372 ms
187,640 KB
testcase_39 AC 98 ms
71,504 KB
testcase_40 AC 97 ms
71,784 KB
testcase_41 AC 116 ms
77,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def solve():
  N = int(input())
  if N<=100:
    return N//3-3
  ans = 30
  d = deque(['0','3','6','9'])
  while len(d):
    s = d.popleft()
    if s[0]!='0':
      n = int(s)
      if n>100 and n<=N:
        ans += 1
    if len(s)<=len(str(N)):
      for l in ['0','3','6','9']:
        d.append(l+s)
  return ans
print(solve())
0