Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
41501 DUANZHIBO 水下探测器 C++ Accepted 0 MS 244 KB 344 2024-02-21 10:53:54

Tests(1/1):


#include<iostream> #include<cstring> using namespace std; char command[101]; int h,s; int main() { cin>>h>>s; 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; }


Judgement Protocol: