Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41450 | Andrew宥杨 | 水下探测器 | C++ | Compile Error | 0 MS | 0 KB | 247 | 2024-02-21 09:05:43 |
#include<bits/stdc++.h> using namespace std; int main(){ int h,s; cin>>h>>s; string s; cin>>s; for(int i=0;i<s.size;i++){ if(s[i]=='u' && s>0){ s--; } else if(s[i]=='d' && s<h){ s++; } } cout<<s; return 0; }