結果
問題 | No.294 SuperFizzBuzz |
ユーザー | fmhr |
提出日時 | 2015-10-25 18:47:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 732 ms / 5,000 ms |
コード長 | 2,540 bytes |
コンパイル時間 | 402 ms |
コンパイル使用メモリ | 82,336 KB |
実行使用メモリ | 75,856 KB |
最終ジャッジ日時 | 2024-09-13 09:03:35 |
合計ジャッジ時間 | 5,056 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,024 KB |
testcase_01 | AC | 41 ms
54,868 KB |
testcase_02 | AC | 38 ms
52,952 KB |
testcase_03 | AC | 39 ms
52,868 KB |
testcase_04 | AC | 38 ms
54,472 KB |
testcase_05 | AC | 39 ms
53,332 KB |
testcase_06 | AC | 59 ms
71,528 KB |
testcase_07 | AC | 83 ms
75,372 KB |
testcase_08 | AC | 402 ms
75,856 KB |
testcase_09 | AC | 732 ms
75,740 KB |
testcase_10 | AC | 731 ms
75,420 KB |
testcase_11 | AC | 134 ms
75,648 KB |
testcase_12 | AC | 444 ms
75,604 KB |
testcase_13 | AC | 485 ms
75,596 KB |
testcase_14 | AC | 711 ms
75,676 KB |
ソースコード
# coding:utf-8 import sys ume_i=[0, 19, 20, 20, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25] ume_j=[0,75711, 151419, 751427, 302841, 902867, 1502853, 5699, 605701, 1205719, 1805703, 2405735, 3005701, 3605711, 11401, 611385, 1211401, 1811391, 2411421, 3011415, 3611383, 4211407, 4811419, 5411397, 6011395, 6611385, 7211393, 7811395, 22793, 622799, 1222795, 1822785, 2422789, 3022785, 3622775, 4222781, 4822807, 5422785, 6022785, 6622785, 7222771, 7822783, 8422785, 9022791, 9622769, 10222757, 10822781, 11422765, 12022781, 12622791, 13222757, 13822781, 14422783, 15022781, 15622793, 16222799, 45571, 645581, 1245591, 1845571, 2445581, 3045545, 3645561, 4245563, 4845567, 5445567, 6045557, 6645539, 7245557, 7845545, 8445561, 9045557, 9645563, 10245539, 10845557, 11445545, 12045553, 12645561, 13245557, 13845559, 14445575, 15045563, 15645565, 16245553, 16845567, 17445591, 18045541, 18645545, 19245537, 19845569, 20445563, 21045561, 21645557, 22245545, 22845567, 23445569, 24045561, 24645569, 25245579, 25845563, 26445559] #def popcount(x): # return bin(x).count("1") def popcount(n): n = (n & 0x5555555555555555) + ((n & 0xAAAAAAAAAAAAAAAA) >> 1) n = (n & 0x3333333333333333) + ((n & 0xCCCCCCCCCCCCCCCC) >> 2) n = (n & 0x0F0F0F0F0F0F0F0F) + ((n & 0xF0F0F0F0F0F0F0F0) >> 4) n = (n & 0x00FF00FF00FF00FF) + ((n & 0xFF00FF00FF00FF00) >> 8) n = (n & 0x0000FFFF0000FFFF) + ((n & 0xFFFF0000FFFF0000) >> 16) n = (n & 0x00000000FFFFFFFF) + ((n & 0xFFFFFFFF00000000) >> 32) return n def solve(): N = int(input()) count = 0 # 100000毎にume # ume_i = [] # ume_j = [] # c = 1000000 p = int(N/100000) start_i = ume_i[p] start_j = ume_j[p] if p!=0: count = p*100000-1 x = 0 for i in range(start_i,26): for j in range(start_j,10000000000000): a = bin(j)[2:] if len(a)>i: # print(i,j,a) start_j = 0 break # print(a) if popcount(j)%3==0 and popcount(j)>=3 and a[-1]=='1': count += 1 # ==== # if count == c: # ume_i.append(i) # ume_j.append(j) # c += 1000000 # ==== if count==N: a = '0'*(i-len(a))+a n = a.replace('0', '3').replace('1', '5') x = ''.join(n) x = int(x) print(x) sys.exit() solve()