| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 43013 | WZH | 水下探测器 | C++ | Accepted | 1 MS | 248 KB | 254 | 2024-03-05 21:02:36 |
#include<bits/stdc++.h> using namespace std; int main() { int n,m; char q[1000]; cin>>n>>m>>q; for(int i=0;i<strlen(q);i++){ if(q[i]=='u'){ if(m>0) m--; } else if(q[i]=='d'){ if(m<n) m++; } } cout<<m; return 0; }