結果
問題 | No.1930 XOR of Two Range |
ユーザー |
![]() |
提出日時 | 2023-07-27 21:38:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 288 ms / 2,000 ms |
コード長 | 393 bytes |
コンパイル時間 | 2,299 ms |
コンパイル使用メモリ | 193,932 KB |
最終ジャッジ日時 | 2025-02-15 19:36:44 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(){ ll L, R, ans=0; cin >> L >> R; if (((R-L+1)/4) % 2 == 1) ans = 1; for (ll i=L*2+(R-L+1)/4*4; i<=L+R; i++){ if (((i-L*2)/2+1) % 2 == 1) ans ^= i; } cout << ans << endl; } int main(){ int T; cin >> T; while(T){ T--; solve(); } return 0; }