Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
41483 老方 水下探测器 C++ 通过 1 MS 236 KB 243 2024-02-21 09:51:06

Tests(1/1):


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


测评信息: