Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
41452 Andrew宥杨 水下探测器 C++ 通过 0 MS 248 KB 249 2024-02-21 09:06:34

Tests(1/1):


#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' && s>0){ s--; } else if(a[i]=='d' && s<h){ s++; } } cout<<s; return 0; }


测评信息: