![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
浙大PAT
lv_zj
这个作者很懒,什么都没留下…
展开
-
1040. Longest Symmetric String (25)
1040. Longest Symmetric String (25)#include #include class CA{public: enum{len=1000}; void run(); char snum[len];};void CA::run(){ gets(snum); int l=strlen(snum); int i,j,mid,sym,ma原创 2013-11-15 08:59:33 · 760 阅读 · 0 评论 -
1027. Colors in Mars (20)
1027. Colors in Mars (20)#include #include using namespace std;class CA{public: void run(); char intto13ch(int t);};char CA::intto13ch(int t){ if(t<10) return t+'0'; else return (t-原创 2013-11-14 11:11:51 · 678 阅读 · 0 评论 -
1021. Deepest Root (25)
1021. Deepest Root (25)#include #include #include #include using namespace std;class A{public: enum{N=10001}; void init(); void run(); int gettreelevel(int c,int f); void gettreele原创 2013-11-14 10:44:22 · 941 阅读 · 0 评论 -
1066. Root of AVL Tree (25)
1066. Root of AVL Tree (25)#include using namespace std;int max(int a,int b){ return a>b?a:b;}class AvlTree{public: struct node { int value; node *left,*right; int height; node(int原创 2013-11-27 22:18:30 · 799 阅读 · 0 评论 -
1024. Palindromic Number (25)
1024. Palindromic Number (25)#include #include #include #include using namespace std;class CA{public: void run(); vector num; bool isPalindromic();};bool CA::isPalindromic(){ vec原创 2013-11-14 10:59:46 · 726 阅读 · 0 评论 -
1026. Table Tennis (30)
1026. Table Tennis (30)#include #include #include #include #include #include using namespace std;class ctable{public: enum{opentime=8*3600,closetime=21*3600}; int curtime; int vip; i原创 2013-11-14 11:08:27 · 908 阅读 · 0 评论 -
1023. Have Fun with Numbers (20)
1023. Have Fun with Numbers (20)#include#include#include #include using namespace std;class CA{public: void run();};void CA::run(){ vector di,ddi,tddi; string sd; cin>>sd; int i原创 2013-11-14 10:56:46 · 763 阅读 · 0 评论 -
1016 Phone Bills (25)
1016 Phone Bills (25) #include #include #include #include #include #include #include using namespace std;struct billnode { string name; int mouth,date,hour,mini,total; string status;原创 2013-11-14 10:20:23 · 975 阅读 · 0 评论 -
1019. General Palindromic Number (20)
1019. General Palindromic Number (20)#include using namespace std;class A{public: enum{N=100}; void init(); void run(); bool ispalindromic(); int digit,base; int ar[N],n;};bool A::ispa原创 2013-11-27 13:22:43 · 691 阅读 · 0 评论 -
1063. Set Similarity (25)
1063. Set Similarity (25)#include #include #include using namespace std;class CA{public: enum{N=50,M=10000}; int n,u[N][M],l[N]; void run(); void getSimilarity(int r1,int r2);};void CA原创 2013-11-27 13:17:06 · 691 阅读 · 0 评论 -
1072. Gas Station (30)
1072. Gas Station (30)#include #include #include using namespace std;class CA{public: enum{N=1001,M=11,INF=0x6FFFFFFF}; struct node { int id,minlen,alllen; bool operator < (const node原创 2013-11-27 10:44:33 · 818 阅读 · 0 评论 -
1006. Sign In and Sign Out (25)
1006. Sign In and Sign Out (25)#include #include class A{public: enum{timelen=9,idlen=16}; void init(); void run();private: struct crecord { char id[idlen]; char time1[timelen];原创 2013-11-12 17:10:41 · 816 阅读 · 0 评论 -
1009. Product of Polynomials (25)
1009. Product of Polynomials (25)#include class A{public: enum{N=1010}; void init(); void run();private: float ar[N*2],r_ar[N*2];};void A::init(){ int i,j,k,index; float fw; for(i=0原创 2013-11-13 10:37:38 · 672 阅读 · 0 评论 -
1018. Public Bike Management (30)
1018. Public Bike Management (30)#include #include #include #include #include using namespace std;class A{public: enum{N=501,INF=0x7FFFFFFF/2}; void init(); void run(); void dijkstra()原创 2013-11-13 10:36:13 · 971 阅读 · 0 评论 -
1015. Reversible Primes (20)
1015. Reversible Primes (20)#include #include class A{public: void run();private: bool isprime(int num); int reverse(int num,int radix);};void A::run(){ int n,d,rn; while(true)原创 2013-11-13 10:21:28 · 649 阅读 · 0 评论 -
1014. Waiting in Line (30)
1014. Waiting in Line (30)#include #include #include class A{public: enum{N=20,M=10,K=1000,max_time=540}; void init(); void run();private: char* traninttimetostr(int itime,char *stime原创 2013-11-13 09:50:24 · 892 阅读 · 0 评论 -
1012. The Best Rank (25)
1012. The Best Rank (25)#include const char les[5]="ACME";class A{public: enum{grade_num=4}; void run();private: struct student { int id; int grades[grade_num];// A C M E int ran原创 2013-11-13 09:29:33 · 871 阅读 · 0 评论 -
1022. Digital Library (30)
1022. Digital Library (30)#include #include #include #include #include #include using namespace std;class CA{public: void run(); map > qm[5]; int n,m;};void CA::run(){ cin>>n;原创 2013-11-14 10:47:32 · 835 阅读 · 0 评论 -
1025. PAT Ranking (25)
1025. PAT Ranking (25)#include #include #include #include #include using namespace std;class CA{public: struct position { int lastrank; int lastscore; int ranks; position(){lastsc原创 2013-11-14 11:04:31 · 920 阅读 · 0 评论 -
1053. Path of Equal Weight (30)
1053. Path of Equal Weight (30)#include #include using namespace std;class CA{public: struct arcnode { int arcid; arcnode *next; }; struct treenode { int weight; arcnode *first;原创 2013-11-15 12:45:01 · 800 阅读 · 0 评论 -
1048. Find Coins (25)
1048. Find Coins (25)#include #include using namespace std;class CA{public: enum{N=100000}; int face[N],n,amount; int findpaircoin(int l,int r,int k); void run();};int CA::findpaircoin(in原创 2013-11-15 12:35:46 · 724 阅读 · 0 评论 -
1047. Student List for Course (25)
1047. Student List for Course (25)#include #include #include #include using namespace std;class CA{public: enum{K=2501}; vector cn[K]; int n,k; void run(); inline int strnametoint(char *原创 2013-11-15 12:34:32 · 711 阅读 · 0 评论 -
1045. Favorite Color Stripe (30)
1045. Favorite Color Stripe (30)原创 2013-11-15 09:00:24 · 1059 阅读 · 0 评论 -
1043. Is It a Binary Search Tree (25)
1043. Is It a Binary Search Tree (25)#include #include #include using namespace std;class CA{public: enum{N=1000}; int n; vector posttree,pt; void run(); bool isabst(int l,int r); bo原创 2013-11-15 09:00:09 · 823 阅读 · 0 评论 -
1037. Magic Coupon (25)
1037. Magic Coupon (25)#include #include #include #include using namespace std;class CA{public: enum{N=100000}; void run(); int clist[N],plist[N],nc,np;};void CA::run(){ int i,t,ma原创 2013-11-14 14:46:57 · 731 阅读 · 0 评论 -
1035. Password (20)
1035. Password (20)#include #include #include using namespace std;class CA{public: struct cuser { string name,pass; }; void run(); bool changepwd(string &s); int n; vector printli原创 2013-11-14 14:44:49 · 690 阅读 · 0 评论 -
1032. Sharing (25)
1032. Sharing (25)#include #include using namespace std;class CA{public: enum{N=100000}; void run(); int ar[N],addr1,addr2,n; bool b[N];};void CA::run(){ n=N; fill_n(ar,n,-1); fill原创 2013-11-14 13:25:05 · 727 阅读 · 0 评论 -
1031. Hello World for U (20)
1031. Hello World for U (20)#include #include #include using namespace std;class CA{public: enum{N=100}; void run(); char s[N];};void CA::run(){ cin>>s; int len,n1,n2,n3; len=str原创 2013-11-14 13:23:17 · 691 阅读 · 0 评论 -
1036. Boys vs Girls (25)
1036. Boys vs Girls (25)#include #include #include #include using namespace std;class cstudent{public: string name,id; int score; bool operator< (const cstudent & st) const { return原创 2013-11-14 14:46:28 · 758 阅读 · 0 评论 -
1034. Head of a Gang (30)
1034. Head of a Gang (30)#include #include #include #include using namespace std;class CA{public: void run(); void addmap(string &s1,string &s2,int w); vector > culist; vector wlist;原创 2013-11-14 13:33:05 · 800 阅读 · 0 评论 -
1039. Course List for Student (25)
1039. Course List for Student (25)#include #include #include #include #include using namespace std;class CA{public: enum{name_len=5}; priority_queue,greater > couse[26][26][26][10]; v原创 2013-11-14 14:50:00 · 918 阅读 · 0 评论 -
1038. Recover the Smallest Number (30)
1038. Recover the Smallest Number (30)#include #include #include #include using namespace std;class CA{public: void run(); string allnum; vector sl;};bool abcmp(const string &a,const原创 2013-11-14 14:48:53 · 752 阅读 · 0 评论 -
1030. Travel Plan (30)
1030. Travel Plan (30)#include #include #include using namespace std;class CA{public: enum{N=501,INF=0x7FFFFFFF/2}; void run(); void dijkstra(); void getbestpath(int v); int n,m,s,d,ar原创 2013-11-14 11:22:44 · 844 阅读 · 0 评论 -
1029. Median (25)
1029. Median (25)#include class CA{public: enum{N=2000020}; void run(); int partion(int low,int high); int ar[N],mn,mid;};int CA::partion(int low,int high){ int i,j,t,t1; i=low;j=high;原创 2013-11-14 11:18:25 · 1000 阅读 · 0 评论 -
1028. List Sorting (25)
1028. List Sorting (25)#include #include #include class cstudent{public: int id; char name[10]; int score; friend bool IdCmp(const cstudent &s1,const cstudent &s2); friend bool NameCmp(原创 2013-11-14 11:17:57 · 875 阅读 · 0 评论 -
1010. Radix (25)
该问题的关键有几点:(1)N1,N2长度是10为数字,用int类型会越界,long类型同样是32字节的,所以也不行,可以统一用double类型,但注意浮点型比较大小是不能直接用==、>、(2)radix2如果直接从小打到遍历会超时,所以需要用二分法。1010. Radix (25)#include #include #include class A{public:原创 2013-11-13 11:36:42 · 1106 阅读 · 0 评论 -
1020. Tree Traversals (25)
1020. Tree Traversals (25)#include #include #include #include #include using namespace std;class A{public: struct node { int no; node *lchild; node *rchild; }; void init(); vo原创 2013-11-13 10:40:26 · 752 阅读 · 0 评论 -
1062. Talent and Virtue (25)
1062. Talent and Virtue (25)#include #include #include using namespace std;class CA{public: struct cperson { enum{l_sage=1,l_nobleman=2,l_fool=3,l_small=4}; int id,talent,virtue; int t原创 2013-11-18 13:16:56 · 787 阅读 · 0 评论 -
1060. Are They Equal (25)
1060. Are They Equal (25)#include #include using namespace std;class CA{public: void run(); void trantoformat(string &ss,int &nn); int n; string s1,s2,szero;};void CA::trantoformat(strin原创 2013-11-17 15:56:40 · 748 阅读 · 0 评论 -
1056. Mice and Rice (25)
1056. Mice and Rice (25)#include #include #include using namespace std;struct mouse{ int no,weight,rank; bool operator < (const mouse& m) const { return weight < m.weight; }};class CA原创 2013-11-17 10:19:09 · 697 阅读 · 0 评论