Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
62013 | 头像本人 | 水下探测器 | C++ | Accepted | 1 MS | 276 KB | 267 | 2023-12-16 16:50:48 |
# include<iostream> using namespace std; int main(){ int b,h,n,s,i=0; string a; cin>>h>>s; cin>>a; for(i=0;a[i]!='\0';i++){ if(s>0 and a[i]=='u'){ s--; } if(s<h and a[i]=='d'){ s++; } }cout<<s; return 0; }