Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
62044 | LJY | 水下探测器 | C++ | Accepted | 1 MS | 272 KB | 322 | 2023-12-16 17:27:17 |
# include<stdio.h> # include<iostream> # include<string> using namespace std; int main(){ int h,s; string str; cin>>h>>s>>str; for(int i=0;i<str.size();i++){ if(str[i]=='u'){ if(s>0){ s--; } }else{ if(s<h) s++; } } cout<<s; return 0; }