AcWing杯 - 第60场周赛
比赛链接:第 60 场周赛
先放代码,题解慢慢补
A AcWing 4494. 吃饭
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<vector>
#include<cstdio>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(b>=a && c>=a) puts("Yes");
else puts("No");
return 0;
}
B AcWing 4495. 数组操作
模拟即可。。。
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<vector>
#include<cstdio>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int,int> PII;
typedef unsigned long long ULL;
const int N=1e5+5;
int n,m;
int a[N];
int main()
{
// freopen("1.in","r",stdin);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
sort(a+1,a+n+1);
for(int i=1,j=1,base=0;i<=m;i++) {
while(j<=n && a[j]-base==0) j++;
if(j>n) {
puts("0");
continue;
}
printf("%d\n",a[j]-base);
base+=a[j]-base;
}
return 0;
}
C AcWing 4496. 吃水果
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<vector>
#include<cstdio>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
const LL P=998244353;
const int N=2000+5;
int n,m,k;
LL f[N][N],s[N];
int main()
{
// freopen("1.in","r",stdin);
cin>>n>>m>>k;
f[1][0]=m;
for(int i=2;i<=n;i++) {
for(int j=0;j<=k;j++) {
// f[i][j] = f[i-1][j] + f[i-1][j-1] * (m-1)
if(j>=1)
f[i][j]=(f[i-1][j]+f[i-1][j-1]*(m-1)%P)%P;
else f[i][j]=f[i-1][j];
}
}
printf("%lld\n",f[n][k]);
return 0;
}