結果
問題 | No.420 mod2漸化式 |
ユーザー |
|
提出日時 | 2019-01-23 11:52:49 |
言語 | Nim (2.2.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 669 bytes |
コンパイル時間 | 2,307 ms |
コンパイル使用メモリ | 61,544 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 10:32:26 |
合計ジャッジ時間 | 3,495 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 WA * 4 |
ソースコード
template times*(n:int,body) = (for _ in 0..<n: body) template `max=`*(x,y) = x = max(x,y) template `min=`*(x,y) = x = min(x,y) proc combination(n,k:int):int = result = 1 let x = k.max(n - k) let y = k.min(n - k) for i in 1..y: result = result * (n+1-i) div i proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() if n >= 32 : quit "0 0",0 if n == 0 : quit "1 0",0 var ans = 0 let count = (31-1).combination(n-1) for i in 0..<31: ans += count * (1 shl i) echo 31.combination(n)," ",ans