Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
43004 | yuzhengxun | 水下探测器 | C++ | Compile Error | 0 MS | 0 KB | 244 | 2024-03-05 20:52:21 |
#include<iostream> using namespace std; int main() { char a[110]; int n,s; cin>>n>>s; for(int i=0;i<strlen(a);i++){ if(a[i]=='u'){ if(s>0) s--; } else if(a[i]=='d'){ if(s<n) s++; } } cout<<s; return 0; }