现在的位置: 首页 > 综合 > 正文

NYOJ658 字符串右移

2016年09月28日 ⁄ 综合 ⁄ 共 209字 ⁄ 字号 评论关闭

原题链接

#include <iostream>
#include <string>
using namespace std;

int main(){
	string str;
	int n;
	while(cin >> str >> n){
		int len = str.size();
		n %= len;
		int count = len - n, j = 0;
		while(j < len){
			cout << str.at(count++ % len);
			++j;
		}
		cout << endl;
	}
	return 0;
}
【上篇】
【下篇】

抱歉!评论已关闭.