Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
4968 | liumingxuan | 水下探测器 | C++ | Accepted | 0 MS | 248 KB | 316 | 2023-01-13 12:58:11 |
#include<bits/stdc++.h> using namespace std; int main(){ int h,t; cin>>h>>t; string s; cin>>s; for(int i=0;i<s.size();i++) if(s[i]=='u')t=max(t-1,0); else t=min(t+1,h); cout<<t; return 0; } /* #include<cstdio> freopen("文件名.in","r",stdin); freopen("文件名.out","w",stdout); */