标签:space empty clu class ase code 字符 zha push
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 15228 | Accepted: 6778 |
Description
Input
Output
Sample Input
5 Xiaoming Xiaohua Xiaowang Zhangsan Lisi 2,3
Sample Output
Zhangsan Xiaohua Xiaoming Xiaowang Lisi
1 #include<stdio.h> 2 #include<vector> 3 #include<string> 4 #include<iostream> 5 using namespace std; 6 vector<string> str; 7 int n; 8 int W,S; 9 int bg,en; 10 int main(){ 11 freopen("in.txt","r",stdin); 12 scanf("%d",&n); 13 for(int i=0;i<n;i++){ 14 string s; 15 cin>>s; 16 str.push_back(s); 17 } 18 scanf("%d",&W); 19 W--; //由于vector数组从0开始,所以此时W要减一 20 getchar(); 21 scanf("%d",&S); 22 while(!str.empty()){ 23 int len=str.size(); 24 W=(W+S-1)%len; 25 cout<<str[W]<<endl; 26 str.erase(str.begin()+W); 27 } 28 }
标签:space empty clu class ase code 字符 zha push
原文地址:http://www.cnblogs.com/muziqiu/p/7276800.html