• 个人简介

    image 苏淼恒


    /*****************************************
    ±¸×¢£º
    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;
    }
    
    
  • 通过的题目

题目标签

语言基础
52
循环语句
39
选择语句
27
语言入门
19
图结构
15
其他
14
动态规划
11
数据结构
9
搜索
9
一本通
9
位运算
8
最短路
8
输入输出
8
一维数组
7
竞赛
6
最小生成树
5
USACO
5
BFS
4
并查集
4
年份
4