题目大意是给定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;
}