Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
61974 | 斜阳草树 | 水下探测器 | C++ | Accepted | 1 MS | 272 KB | 262 | 2023-12-16 16:32:40 |
# include<iostream> # include<cstring> using namespace std; char y[105]; int h,s; int main(){ cin>>h>>s; cin>>y; for(int i=0;i<strlen(y);i++){ if(y[i]=='u' and s!=0)s--; if(y[i]=='d' and s!=h)s++; } cout<<s; return 0; }