苏淼恒
/*****************************************
±¸×¢£º
2
2 9 1 0 20
48
2
20 90 10 6 20
2387
2
200 900 100 6 200
241632
******************************************/
#include <queue>
#include <set>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <string.h>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
#define LL long long
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
int divide(int n)
{
for(int i = 2; i <= n; i++)
{
if(n % i == 0)
{
int k = 0;
while(n % i == 0)
{
n /= i;
k++;
}
if(k > 1)
return 0;
}
}
return 1;
}
int T,L,R,a,b,c;
int anss;
int sum;
int main()
{
// cout << (0 ^ 12);
cin >> T;
cin >> L >> R >> a >> b >> c;
for(int k = 1;k <= T;k++)
{
if(k == 1)
{
for(int i = L;i <= R;i++)
{
if(i == 1)
{
anss += 1;
}
else if(divide(i))
{
anss += i;
}
}
// cout << anss<< endl;
sum ^= anss;
anss = 0;
}
else
{
int x = ((L ^ b) + a) % c + 1;
int y = ((R ^ b) + a) % c + 1;
L = min(x,y);
R = max(x,y);
for(int i = L;i <= R;i++)
{
if(i == 1)
{
anss += 1;
}
else if(divide(i))
{
anss += i;
}
}
sum ^= anss;
// cout << L <<endl<< R << endl;
// cout << anss << endl;
anss = 0;
}
}
cout << sum << endl;
return 0;
}
/*****************************************
±¸×¢£º
5
6 1
8 4
12 7
6 4
9 4
Y
N
Y
N
Y
******************************************/
#include <queue>
#include <set>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <string.h>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
#define LL long long
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
int n;
int m, a;
int h[N];
int main()
{
cin >> n;
for(int i = 1;i <= n;i++)
{
int t = 1,cnt = 0; //µÚ¼¸¸öºÉÒ¶
cin >> m >> a;
memset(h,0,sizeof h);
while(h[t] == 0)
{
h[t]++;
cnt++;
t += a;
if(t > m) //t³¬¹ým˵Ã÷ÒªÌøµÄºÉÒ¶²»´æÔÚ£¬ÖØÍ·ËãÆð
t -= m;
}
if(cnt == m)
puts("YES");
else
puts("NO");
// cout << cnt;
}
return 0;
}
/*****************************************
±¸×¢£º
5 8
4
******************************************/
#include <queue>
#include <set>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <string.h>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
#define LL long long
const int N = 1e5 + 10;
const int mod = 993244853;
const int INF = 0x3f3f3f3f;
LL ans;
int l,r;
int F(int l,int r)
{
int maxx = 0;
for(int i = l;i <= r;i++)
{
for(int j = i + 1;j <= r;j++)
{
maxx = max(__gcd(i,j),maxx);
}
}
return maxx;
}
int main()
{
cin >> l >> r;
for(int k = l + 1;k <= r;k++)
{
ans += F(l,k);
ans %= mod;
}
cout << ans << endl;
return 0;
}