結果
| 問題 | No.1930 XOR of Two Range |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2022-05-08 22:11:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 544 bytes |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 41,344 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 11:21:45 |
| 合計ジャッジ時間 | 1,444 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 1930.cc: No.1930 XOR of Two Range - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
typedef long long ll;
/* global variables */
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
ll l, r;
scanf("%lld%lld", &l, &r);
ll k = r + 1 - l;
ll x = k / 4, y = k % 4;
ll sum = x & 1;
if (y == 1) sum ^= 2 * l + x * 4;
else if (y > 1) sum ^= 1;
printf("%lld\n", sum);
}
return 0;
}
tnakao0123