結果

問題 No.2206 Popcount Sum 2
ユーザー とりゐとりゐ
提出日時 2023-01-16 02:12:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 522 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 80,924 KB
最終ジャッジ日時 2023-09-15 10:59:31
合計ジャッジ時間 6,706 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
75,760 KB
testcase_01 AC 85 ms
75,736 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def popcount(n):
  c=(n&0x5555555555555555)+((n>>1)&0x5555555555555555)
  c=(c&0x3333333333333333)+((c>>2)&0x3333333333333333)
  c=(c&0x0f0f0f0f0f0f0f0f)+((c>>4)&0x0f0f0f0f0f0f0f0f)
  c=(c&0x00ff00ff00ff00ff)+((c>>8)&0x00ff00ff00ff00ff)
  c=(c&0x0000ffff0000ffff)+((c>>16)&0x0000ffff0000ffff)
  c=(c&0x00000000ffffffff)+((c>>32)&0x00000000ffffffff)
  return c

mod=998244353
for _ in range(int(input())):
  n,m=map(int,input().split())
  ans=0
  for i in range(1,2**n):
    if popcount(i)<=m:
      ans+=i
  print(ans%mod)
0