結果
問題 | No.822 Bitwise AND |
ユーザー |
|
提出日時 | 2024-09-22 19:21:21 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
AC
|
実行時間 | 1,775 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 6,940 KB |
実行使用メモリ | 23,168 KB |
最終ジャッジ日時 | 2024-09-22 19:21:38 |
合計ジャッジ時間 | 17,503 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
(use scheme.bitwise)(define (calculate n k)(if (< n k)-1(let loop-n ((x 0) (ans 0))(if (= x 123456)ans(loop-n (+ x 1)(+ ans (let loop-k ((current-k 0) (count 0))(if (> current-k k)count(let ((y (+ x current-k)))(if (= (bitwise-and x y) n)(loop-k (+ current-k 1) (+ count 1))(loop-k (+ current-k 1) count)))))))))))(define yuki812(let*((n (read))(k (read))(a (calculate n k)))(if (= a -1)(display "INF\n")(print a))))