luogu#P6052. [RC-02] yltx 数对

[RC-02] yltx 数对

Background

yltx has once again come up with a problem that they cannot solve...

Problem Description

yltx defines that if a prime pair (x,y)(x,y) satisfies that x×y3×(xy)x\times y-3\times (x-y) is prime, then it is called a yltx pair.

He gives you TT pairs (x,y)(x,y). Please check whether they are yltx pairs.

The data is given in the form of a seed (x0,y0)(x_0,y_0).

Perform TT times of $x_0\leftarrow (7x_0+13)\ \mathrm{xor}\ (x_0\div 13-7)$. For the value obtained in the ii-th execution, first take modulo 10410^4, add 10410^4, take modulo 10410^4 again, then add 11, and you get the xx of the ii-th test case. Here division means integer division, and x0x_0 is treated as a 32-bit signed integer.

Use the same method to get yy.

Data generation template:

#include<bits/stdc++.h>
using namespace std;
int T,x_0,y_0;
int main() {
	scanf("%d%d%d",&T,&x_0,&y_0);
	while(T--){
		x_0=((7*x_0+13)^(x_0/13-7));
		y_0=((7*y_0+13)^(y_0/13-7));
		int x=(x_0%10000+10000)%10000+1,y=(y_0%10000+10000)%10000+1;
		//x,y即为一组(x,y)。
	}
	return 0;
}

Input Format

The first line contains three integers T,x0,y0T,x_0,y_0.

Output Format

11 line. Output how many pairs are yltx pairs.

100000 1 2
321

Hint

The Constraints for each test point are as follows:

Test Point T Subtask
1 10\le10 1
2 20\le20
3 50\le50
4 100\le100
5 500\le500
6 1000\le1000
7 5000\le5000 2
8 104\le10^4
9 5×104\le5\times10^4
10 4×105\le4\times10^5
11 106\le10^6
12 5×106\le5\times10^6
13 4×107\le4\times10^7 3
14
15
16
17
18
19
20

Each Subtask is tested as a bundled group of test points.

This problem provides testdata for download, but we hope you will use the data to do the right thing.

Translated by ChatGPT 5