結果
| 問題 | 
                            No.2132 1 or X Game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             chro_96
                         | 
                    
| 提出日時 | 2022-11-25 22:42:19 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 614 bytes | 
| コンパイル時間 | 347 ms | 
| コンパイル使用メモリ | 29,184 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-02 05:18:33 | 
| 合計ジャッジ時間 | 2,676 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | WA * 11 | 
ソースコード
#include <stdio.h>
int main () {
  int t = 0;
  long long n = 0LL;
  long long x = 0LL;
  
  int res = 0;
  
  long long mod_num = 998244353LL;
  
  res = scanf("%d", &t);
  
  while (t > 0) {
    res = scanf("%lld", &n);
    res = scanf("%lld", &x);
    if (x%2LL == 1LL) {
      printf("%lld\n", ((n+1LL)/2LL)%mod_num);
    } else {
      long long ans = (n/(2LL*x+1LL))*(x+1LL);
      if (n%(2LL*x+1LL) < x) {
        ans += (n%(2LL*x+1LL)+1LL)/2LL;
      } else {
        ans += 1LL+(n%(2LL*x+1LL)-x)/2LL;
        ans += x/2LL;
      }
      printf("%lld\n", ans%mod_num);
    }
    t--;
  }
  
  return 0;
}
            
            
            
        
            
chro_96