其他分享
首页 > 其他分享> > 【Kick Start Round G】Dogs and Cats

【Kick Start Round G】Dogs and Cats

作者:互联网

https://codingcompetitions.withgoogle.com/kickstart/round/00000000004362d6/00000000008b3771

分析

签到题。

按照题意模拟。

#include <bits/stdc++.h>
using namespace std;  
#define LL long long
int T,N,D,C;
LL c,M;
int main()
{
	scanf("%d",&T);
	for(int i=1;i<=T;i++)
	{
		printf("Case #%d: ",i);
		scanf("%d%d%d%lld",&N,&D,&C,&M);
		c=C;
		getchar();
		char ch;
		int f=1,f2=1;
		for(int i=0;i<N;i++)
		{
			ch=getchar();
			if(ch=='D'&&!f2)f=0;
			if(ch=='D')D--,c+=M;
			if(ch=='C')c--;
			if(D<0)f=0;
			if(c<0)f2=0;
		}
		if(f)printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}	

标签:00000000004362d6,kickstart,题意,int,LL,long,Start,Cats,Round
来源: https://www.cnblogs.com/tsyxxxka/p/15421097.html