This commit is contained in:
2025-03-22 21:12:39 +08:00
parent e59ed31afe
commit 504cf57178
5 changed files with 162 additions and 0 deletions

28
ACM/CQUPT-19/B.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;
long long xors(long long n) {
const long long X = 1000000007;
if (n * n < X) {
return n % 2;
}
long long result = 0;
long long j = 1;
while (j <= n) {
long long val = X / j;
long long left = j;
long long right = min(n, X / val);
long long count = right - left + 1;
result ^= count;
j = right + 1;
}
return result;
}
int main() {
int t;
cin >> t;
while (t-- > 0) {
long long n;
cin >> n;
cout << xors(n) << endl;
}
}