Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
24459 | LeoWang | 水下探测器 | C++ | Accepted | 0 MS | 240 KB | 230 | 2023-08-13 01:11:44 |
#include<iostream> using namespace std; int main() { int h,s; string str; cin>>h>>s>>str; for(int i=0;i<str .size();i++){ if(str[i]=='u'){ if(s>0) s--; } else if(s<h)s++; } cout<<s; return 0; }