0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:36:27 +00:00

#1539. 【2022.09.07 模拟题】报数

https://sjzezoj.com/submission/55887
This commit is contained in:
Baoshuo Ren 2022-09-07 14:41:34 +08:00
parent 5ecac15e1e
commit ab3df8d7c7
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
24 changed files with 123 additions and 0 deletions

54
S2OJ/1539/1539.cpp Normal file
View File

@ -0,0 +1,54 @@
#include <iostream>
#include <algorithm>
using std::cin;
using std::cout;
const char endl = '\n';
int t, l, r, a, b, c, ans;
int p, cnt, primes[10000005], sum[10000005];
bool not_prime[10000005];
inline bool check(int x) {
int sum = 0;
while (x) {
sum += x % 10;
x /= 10;
}
return !not_prime[sum];
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
for (int i = 2; i <= 10000000; i++) {
if (!not_prime[i]) primes[++p] = i;
for (int j = 1; j <= p && primes[j] * i <= 10000000; j++) {
not_prime[primes[j] * i] = true;
if (i % primes[j] == 0) break;
}
}
for (int i = 1; i <= 10000000; i++) {
if (!not_prime[i] && check(i)) sum[i] = sum[i - 1] + 1;
else sum[i] = sum[i - 1];
}
cin >> t >> l >> r >> a >> b >> c;
while (t--) {
ans ^= sum[r] - sum[l - 1];
l = ((l ^ b) + a) % c + 1;
r = ((r ^ b) + a) % c + 1;
if (l > r) std::swap(l, r);
}
cout << ans << endl;
return 0;
}

BIN
S2OJ/1539/data/ex_number1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/ex_number1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/number9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1539/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.