2 条题解

  • 0
    @ 2023-5-27 17:02:57
    • 本题只与防御值和栏位有关系,按照题目用队列模拟即可,当栏位不够时看一下队首元素是不是 冰霜球,如果不是直接出队,是防御+6即可。比上一场的容易多了hh 最后附上代码
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const int N=2e5+10;
    int main() {
    	std::ios::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
    	int t;
    	cin>>t;
    	int jz=1,lw=3;
    	int fy=0;
    	queue<int> q;
    	int count=0;
    	while(t--) {
    		int op;
    		string x;
    		cin>>op>>x;
    		if(op==0) {
    			if(x=="KR") {
    				lw+=2;
    			} else if(x=="LJTN") {
    				count++;
    				lw--;
    				q.push(1);
    				if(lw==-1) {
    					if(q.front()==1) {
    						count--;
    						fy+=6;
    					}
    					q.pop();
    					lw++;
    				}
    			} else if(x=="QXSD") {
    				q.push(2);
    				lw--;
    				if(lw==-1) {
    					if(q.front()==1) {
    						count--;
    						fy+=6;
    					}
    					q.pop();
    					lw++;
    				}
    			} else if(x=="QH") {
    				q.push(3);
    				lw--;
    				if(lw==-1) {
    					if(q.front()==1) {
    						count--;
    						fy+=6;
    					}
    					q.pop();
    					lw++;
    				}
    			} else if(x=="JN") {
    				q.push(4);
    				lw--;
    				if(lw==-1) {
    					if(q.front()==1) {
    						count--;
    						fy+=6;
    					}
    					q.pop();
    					lw++;
    				}
    			} else if(x=="SCSF"&&!q.empty()) {
    				if(q.front()==1) {
    					count--;
    					fy+=12;
    				}
    				lw++;
    				q.pop();
    			}
    		} else {
    			if(x=="SH") {
    				int sh;
    				cin>>sh;
    				if(fy+count*3>=sh) {
    					cout<<"YES"<<endl;
    				} else {
    					cout<<"NO"<<endl;
    				}
    				fy=0;
    			}
    		}
    	}
    	return 0;
    }
    

    信息

    ID
    824
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    递交数
    119
    已通过
    12
    上传者