Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41453 | jiabokai | 水下探测器 | C++ | Wrong Answer | 0 MS | 244 KB | 271 | 2024-02-21 09:07:06 |
#include<bits/stdc++.h> using namespace std; int main() { int h,s; cin>>h>>s; string a; cin>>a; for(int i=0;i<a.size();i++){ if(a[i]=='u'){ if(s>0){ s++; } } if(a[i]=='d'){ if(s<h){ s--; } } } cout<<s; return 0; }