1 #include<iostream> 2 #include <vector> 3 using namespace std; 4 //author: Qiang 5 int main(){ 6 int n; 7 cin>>n; 8 vector<char>obj1; 9 vector<char>obj2; 10 vector<char>::iterator it; 11 char s; 12 for(int i=0;i<n;i++){ 13 s='A'+i; 14 if(i==0){ 15 obj1.push_back(s); 16 obj2.push_back(s); 17 }else{ 18 obj2.push_back(s); 19 for(it=obj1.begin();it!=obj1.end();it++){ 20 obj2.push_back(*it); 21 } 22 obj1.clear(); 23 for(it=obj2.begin();it!=obj2.end();it++){ 24 obj1.push_back(*it); 25 } 26 } 27 } 28 for(it=obj2.begin();it!=obj2.end();it++)//size()容器中實際數據個數 29 { 30 cout<<*it; 31 } 32 return 0; 33 }