Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
62217 斜阳草树 水下探测器 C++ Accepted 1 MS 276 KB 262 2023-12-19 12:34:10

Tests(5/5):


Code:

# 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; }