Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
7237 A班-许锘林 水下探测器 C++ 通过 100 1 MS 252 KB 279 2025-03-15 16:26:30

Tests(10/10):


#include <bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n>>x; char a[1000]; cin>>a; for(int i = 0;i < strlen(a);i++) { if(a[i] == 'u' && x > 0) { x--; } else if(a[i] == 'd' && x < n) { x++; } } cout<<x; return 0; }


测评信息: