Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41498 | DUANZHIBO | 水下探测器 | C++ | Wrong Answer | 0 MS | 240 KB | 344 | 2024-02-21 10:52:18 |
#include<iostream> #include<cstring> using namespace std; char command[101]; int h,s; int main() { cin>>s>>h; 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; }