結果
| 問題 | No.2132 1 or X Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-25 22:16:13 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 611 bytes |
| 記録 | |
| コンパイル時間 | 146 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-10-02 04:50:17 |
| 合計ジャッジ時間 | 15,035 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 WA * 5 |
コンパイルメッセージ
Syntax OK
ソースコード
gets.to_i.times{
n,x=gets.split.map &:to_i
ans=0
n+=1
if x%2==1
ans+=n/2
else
t=x*(x+1)
ans+=n/t*(x/2*(x+2))
n%=t
if n<=x
ans+=n/2
else
n-=x
ans+=x/2
if n<=x
ans+=(n+1)/2
else
n-=x
ans+=x/2
t=n/x
ans+=2*t
ans+=(x/2-2)*t
ans+=(t+1)/2
n%=x
if n<=t+1
if t%2==0
ans+=(n+1)/2
else
ans+=n/2
end
else
ans+=(t+2)/2
n-=t+1
ans+=(n+1)/2
end
end
end
end
p ans%998244353
}