結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
|
提出日時 | 2015-10-24 00:49:13 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 752 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,696 KB |
最終ジャッジ日時 | 2024-09-13 04:31:22 |
合計ジャッジ時間 | 6,765 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | -- * 12 |
ソースコード
#!/usr/bin/python def comb(n,r): if r==0: return 1 ret=1 if r>n//2: r=n-r for i in range(r): ret=ret*(n-i)/(i+1) return ret def popcnt32(n): m1=0x55555555 m2=0x33333333 m4=0x0f0f0f0f m8=0x00ff00ff m16=0x0000ffff n=((n>>1)&m1)+(n&m1) n=((n>>2)&m2)+(n&m2) n=((n>>4)&m4)+(n&m4) n=((n>>8)&m8)+(n&m8) n=((n>>16)&m16)+(n&m16) return n if 'maketrans' in str.__dict__: maketrans=str.maketrans raw_input=input else: from string import maketrans n=int(raw_input()) digits=2 while True: s=0 five=2 while five<=digits: s+=comb(digits,five) five+=3 if n<=s: break n-=s digits+=1 i=1 while True: if popcnt32(i)%3==2: n-=1 if n==0: print(('{:0'+str(digits)+'b}').format(i).translate(maketrans('01','35'))+'5') break i+=1