Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41463 | Xiyou | 水下探测器 | C++ | Wrong Answer | 0 MS | 244 KB | 272 | 2024-02-21 09:16:47 |
#include<bits/stdc++.h> using namespace std; int main(){ char a[110]; int h,s; cin>>h>>s>>a; for(int i=0;i<strlen(a);i++){ if(a[i]=='u'){ if(s>1){ s--; } }else if(a[i]=='d'){ if(s<h-1){ s++; } } } cout<<s; return 0; }