| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 88786 | sh25_zhangyj | 水下探测器 | C++ | 通过 | 0 MS | 240 KB | 419 | 2026-05-15 15:41:35 |
#include <iostream> #include <string> using namespace std; int main() { int h, s; cin >> h >> s; string commands; cin >> commands; int depth = s; for (char cmd : commands) { if (cmd == 'u') { if (depth > 0) depth--; } else if (cmd == 'd') { if (depth < h) depth++; } } cout << depth << endl; return 0; }