标签:c++
Description
Input
Output
Sample Input
7 Bo Pat Jean Kevin Claude William Marybeth 6 Jim Ben Zoe Joey Frederick Annabelle 5 John Bill Fran Stan Cece 0
Sample Output
SET 1 Bo Jean Claude Marybeth William Kevin Pat SET 2 Jim Zoe Frederick Annabelle Joey Ben SET 3 John Fran Cece Stan Bill
#include <iostream> #include <string> #include <cstring> using namespace std; int main() { int c=1; int n; while(cin>>n&&n) { string a[20]; int i; for(i=1;i<=n;i++) cin>>a[i]; cout<<"SET "<<c<<endl; if(n%2==0) { for(i=1;i<=n;i=i+2) cout<<a[i]<<endl; for(i=n;i>=1;i=i-2) cout<<a[i]<<endl; } else { for(i=1;i<=n;i=i+2) cout<<a[i]<<endl; for(i=n-1;i>=1;i=i-2) cout<<a[i]<<endl; } c++; } return 0; } /* 6 Jim Ben Zoe Joey Frederick Annabelle */
POJ 2013 Symmetric Order,布布扣,bubuko.com
标签:c++
原文地址:http://blog.csdn.net/sunshumin/article/details/38494829