1 条题解

  • 0
    @ 2025-8-24 22:42:30

    自动搬运

    查看原文

    来自洛谷,原作者为

    avatar qkj_qwq
    注意我的 Uid!|| 大号:qkj(Uid 1007676)|| 宣题目 U600000 || 宣比赛 240000 || 宣广告板 https://www.luogu.me/paste/aqn73hir

    搬运于2025-08-24 22:42:30,当前版本为作者最后更新于2025-07-26 10:30:47,作者可能在搬运后再次修改,您可在原文处查看最新版

    自动搬运只会搬运当前题目点赞数最高的题解,您可前往洛谷题解查看更多

    以下是正文


    试题 A

    找规律。模拟斐波那契数列,每次都对 1010 取模,取个位输出。

    :::info[代码]

    #include<bits/stdc++.h>
    #define int long long
    using namespace std;
    signed main()
    {
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    	cout.tie(0);
    	int a=0,b=1,c;
    	cout<<"1 ";
    	for(int i=2;i<=600;i++)
    	{
    		cout<<(c=(a+b)%10)<<' ';
    		a=b%10;b=c%10;
    		if(i%60==0)cout<<'\n';
    	}
    	return 0;
    }
    

    :::

    输出:

    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    

    可以发现,6060 个数为一次循环,且每一次循环存在 8877。那么,答案就是:202202011200÷60×8=26960268160202202011200\div60\times8=26960268160

    试题 B

    直接暴力判断质数。反正没有时间限制。

    :::info[暴力代码]

    #include<bits/stdc++.h>
    #define int long long
    using namespace std;
    bool ss(int n)
    {
    	if(n<2)return 0;
    	if(n==2)return 1;
    	if(n%2==0)return 0;
    	for(int i=3;i*i<=n;i+=2)
    		if(n%i==0)return 0;
    	return 1;
    }
    signed main()
    {
    	freopen("primes.txt","r",stdin);
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    	cout.tie(0);
    	int n,s=0;
    	while(cin>>n)if(ss(n))s++;
    	cout<<s;
    	return 0;
    }
    

    :::

    答案是 342693342693

    • 1

    [蓝桥杯 2022 国 C] 填空问题(缺少prime.txt)

    信息

    ID
    8038
    时间
    1000ms
    内存
    128MiB
    难度
    2
    标签
    递交数
    0
    已通过
    0
    上传者