首页 > 代码库 > MP3光标移动
MP3光标移动
#include<iostream> #include<string.h> using namespace std; int main() { int N; cin>>N; int first = 1; int last = N; int start = 1; int length = 4; int curr = 1; char str[100]; cin>>str; int num = strlen(str); for(int i=0; i<num; i++) { char ch = str[i]; if(ch==‘U‘) { if(curr == first) { start = N<=4 ? start : last - 3; curr = N; } else if(curr == start) { start = N<=4 ? start : start - 1; curr = start; } else { curr = curr-1; } } else if(ch==‘D‘) { if(curr == last) { start = 1; curr = 1; } else if(curr == start+length-1) { start = start + 1; curr = curr+1; } else { curr = curr+1; } } else { } } for(int i=start; i<start+4; i++) { if(i<=last) { cout<<i; if(i!=start+3 && i!= last) { cout<<‘ ‘; } } } cout<<endl<<curr<<endl; return 0; }
MP3光标移动
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。