2021CCPC网络赛重赛补题1

在这里插入图片描述
题目大意是给定x,让你求比x第一个大的质数和第二个质数和除二向下取整。看看代码我真哭了,当时想线性筛欧拉筛,真麻!!!!!!!

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int T;
    cin >> T;
    while (T --)
    {
        long long x;
      scanf("%lld", &x);
        if (x == 1){
            puts("YES");
        } else {
            puts("NO");
        }
    }
    return 0;
}

在这里插入图片描述

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MOD = 998244353;
const int N = 1e5 + 10;
int cnt[N];
LL f[10];
char mh[N];
char sstr[15] = "nunhehheh";
LL qmi(int a, int k)
{
	LL res = 1%MOD,u = a;
	while (k)
	{
		if (k & 1) res = res*u%MOD;
		u = u*u%MOD;
		k >>= 1;
	}
	return res;
}
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		LL res = 0;
		memset(cnt, 0, sizeof cnt);
		memset(f, 0, sizeof f);
		scanf("%s", mh);
		int n = strlen(mh);
		for (int i = n; i >= 0; i--)
		{
			cnt[i] = cnt[i + 1];
			if (mh[i] == 'a')
				cnt[i]++;
		}
		f[0] = 1;
		for (int i = 0; i < n; i++)
		{
			LL  t = f[9];
			for (int j = 9; j >=1; j--)
			{
				if (mh[i] == sstr[j-1])
					f[j] = (f[j] + f[j - 1]) % MOD;
			}
			if (f[9]!=t)
			{
				res = (res + ((f[9]-t)*(qmi(2, cnt[i + 1])-1)+MOD)%MOD)%MOD;
			}
		}
		printf("%lld\n", res);
	}
	return 0;
}

在这里插入图片描述
在这里插入图片描述

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int a, b, c;
		int x0, x1, y0, y1, y2;
		scanf("%d%d%d", &a, &b, &c);
		scanf("%d%d%d%d%d", &x0, &x1, &y0, &y1, &y2);
		int x2 = x1 + (x1 - x0);
		LL ta = (LL)a*x0*x0 + b * x0 + c;
		LL tb = (LL)a*x1*x1 + b * x1 + c;
		LL tc = (LL)a*x2*x2 + b * x2 + c;
		if (ta > y0&&tb <= y2 && tc < y0&&tb != y0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值