Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41496 | DUANZHIBO | 水下探测器 | C++ | Wrong Answer | 1 MS | 252 KB | 307 | 2024-02-21 10:50:15 |
#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 if(command[i]=='d'&&s<h){ s++; } } cout<<s; return 0; }