| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 15276 | 毕潇天 | 水下探测器 | C++ | Accepted | 0 MS | 236 KB | 347 | 2023-04-21 18:27:28 |
#include <bits/stdc++.h> using namespace std; int main(){ int h,s; char a[100]; cin >> h >> s; cin >> a; int depth=s; for(int i=0;i<strlen(a);i++) { if(a[i]=='u') { depth--; if(depth<0){ depth++; } } if(a[i]=='d') { depth++; if(depth>h){ depth--; } } } cout << depth; }