Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
41501 DUANZHIBO 水下探测器 C++ 通过 0 MS 244 KB 344 2024-02-21 10:53:54

Tests(1/1):


#include<iostream> #include<cstring> using namespace std; char command[101]; int h,s; int main() { cin>>h>>s; cin>>command; for(int i=0;i<strlen(command);i++){ if(command[i]=='u'){ if(s>0){ s--; } else continue; } else if(command[i]=='d'&&s<h){ s++; } else continue; } cout<<s; return 0; }


测评信息: