ACM-ICPC 模板代码(自用)
View Code
1 #include <iostream> 2 #include <fstream> 3 #include <stdio.h> 4 using namespace std; 5 6 7 void fout(char n) 8 { 9 string cppname=" .cpp"; 10 cppname[0]=n; 11 string inname=" .in"; 12 inname[0]=n; 13 string pname="//freopen(\"a.in\",\"r\",stdin);"; 14 pname[11]=n; 15 ofstream out1(cppname.c_str()); 16 ofstream outa(inname.c_str()); 17 out1<<"#include <vector>"<<endl; 18 out1<<"#include <list>"<<endl; 19 out1<<"#include <map>"<<endl; 20 out1<<"#include <set>"<<endl; 21 out1<<"#include <deque>"<<endl; 22 out1<<"#include <stack>"<<endl; 23 out1<<"#include <memory.h>"<<endl; 24 out1<<"#include <bitset>"<<endl; 25 out1<<"#include <algorithm>"<<endl; 26 out1<<"#include <functional>"<<endl; 27 out1<<"#include <numeric>"<<endl; 28 out1<<"#include <utility>"<<endl; 29 out1<<"#include <sstream>"<<endl; 30 out1<<"#include <iostream>"<<endl; 31 out1<<"#include <iomanip>"<<endl; 32 out1<<"#include <cstdio>"<<endl; 33 out1<<"#include <cmath>"<<endl; 34 out1<<"#include <cstdlib>"<<endl; 35 out1<<"#include <ctime>"<<endl; 36 out1<<"#include <cstring>"<<endl; 37 out1<<endl; 38 out1<<"using namespace std;"<<endl; 39 out1<<endl; 40 out1<<endl; 41 out1<<"int main()"<<endl; 42 out1<<"{"<<endl<<pname<<endl; 43 out1<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; 44 out1<<" return 0;"<<endl; 45 out1<<"}"<<endl; 46 47 } 48 int main() 49 { 50 int a,b=0; 51 char bb; 52 string s1,s2; 53 printf("*******************************************************************\n"); 54 printf("** UESTC_ACM-ICPC auto code tool **\n"); 55 printf("*******************************************************************\n"); 56 printf("** only for kevinSWAT **\n"); 57 printf("*******************************************************************\n"); 58 59 while(1) 60 { 61 cout<<" the last number of problems:"; 62 cin>>bb; 63 if(bb>='A' &&bb<='Z')b=bb-'A'+1; 64 else if(bb>='a'&&bb<='z')b=bb-'a'+1; 65 if(b>=1 &&b<=26)break; 66 else b=0; 67 } 68 cout<<"In this content,there are "<<b<<" problems yet!"<<endl; 69 for(char n='a'; n<=b+'a'-1; n++) 70 fout(n); 71 return 0; 72 }