PAT
所谓刹那
这个作者很懒,什么都没留下…
展开
-
PAT甲1013 Battle Over Cities (25)(25 分)
#include <stdio.h>#include <string.h>using namespace std;int N,M,K; int G[1010][1010];int t;bool vis[1010];void DFS(int now){ vis[now]=true; for(int i=1;i<=N;i++) ...原创 2018-08-09 17:36:19 · 147 阅读 · 0 评论 -
PAT甲1014 Waiting in Line (30)(30 分)
#include <stdio.h>#include <algorithm>#include <vector>using namespace std;int N,M,K,Q;struct line{ int index; int endtime; int starttime; vector<int> q...原创 2018-08-09 18:43:38 · 102 阅读 · 0 评论 -
PAT甲1015 Reversible Primes (20)(20 分)
#include <stdio.h>#include <math.h>using namespace std;int reverse(int a,int radix){ if(a==0)return a; int b[110],len=0; while(a>0) { b[len++]=a%radix; ...原创 2018-08-09 18:53:33 · 132 阅读 · 0 评论 -
PAT甲1016 Phone Bills (25)(25 分)
搞死我了,没注意顾客id是20长度的,开了个20的字符数组,怎么都A不了。气死我了#include <stdio.h>#include <string.h>#include <algorithm>#include <vector>#include <map>#include <string>using name...原创 2018-08-09 20:13:52 · 195 阅读 · 0 评论 -
PAT甲1017 Queueing at Bank (25)(25 分)
#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;math.h&amp;gt;#include &amp;lt;stdlib.h&amp;gt;#include &amp;lt;string.h&amp;gt;#include &amp;lt;algorithm&amp;gt;using na原创 2018-08-09 20:31:33 · 118 阅读 · 0 评论 -
PAT甲1018 Public Bike Management (30)(30 分)
#include <stdio.h>#include <vector>#include <string.h>using namespace std;const int inf=1000000000;int G[510][510];bool vis[510];int d[510];vector<int> pre[510];int C...原创 2018-08-09 21:10:09 · 119 阅读 · 0 评论 -
PAT甲1019 General Palindromic Number (20)(20 分)
#include <stdio.h>using namespace std;void change(int N,int radix,int A[],int &len){ if(N==0) { A[len++]=0; return; } while(N>0) { A[len++]...原创 2018-08-10 21:38:46 · 139 阅读 · 0 评论 -
PAT甲1020 Tree Traversals (25)(25 分)
#include <stdio.h>#include <queue>using namespace std;int in[110],post[110];struct node{ int data; node* lchild; node* rchild;};node* newnode(int x){ node* root=...原创 2018-08-10 21:52:00 · 134 阅读 · 0 评论 -
PAT甲1021 Deepest Root (25)(25 分)
#include <stdio.h>#include <vector>#include <queue>#include <algorithm>#include <string.h>using namespace std;vector<int> G[10010];int height[10010];bool v...原创 2018-08-10 22:14:16 · 98 阅读 · 0 评论 -
PAT 甲1001 A+B Format (20)(20 分)
#include <stdio.h>#include <stdlib.h> using namespace std;void change(int a,char c[],int &l){ if(a==0) { c[l++]=0+'0'; return; } int x=abs(a); ...原创 2018-08-06 20:29:41 · 79 阅读 · 0 评论 -
PAT甲1002 A+B for Polynomials (25)(25 分)
#include <stdio.h>#include <stdlib.h> using namespace std;struct polyn{ int exp; double co;}A[20],B[20],C[50];int N,M;int main() { scanf("%d",&N); for(int i=0;...原创 2018-08-06 20:39:52 · 102 阅读 · 0 评论 -
PAT甲1003 Emergency (25)(25 分)
#include <stdio.h>#include <stdlib.h> #include <vector>#include <cstring>using namespace std;const int inf=1000000000;int G[510][510];bool vis[510];int hands[510],d[51...原创 2018-08-06 21:08:55 · 190 阅读 · 0 评论 -
PAT甲1004 Counting Leaves (30)(30 分)
#include <stdio.h>#include <stdlib.h> #include <vector>#include <cstring>#include <queue>using namespace std;struct node{ int data; vector<int> chil...原创 2018-08-06 21:18:53 · 106 阅读 · 0 评论 -
PAT甲1005 Spell It Right (20)(20 分)
#include <stdio.h>#include <stdlib.h> #include <vector>#include <cstring>#include <queue>#include <string>#include <iostream>using namespace std;stri原创 2018-08-06 21:28:44 · 161 阅读 · 0 评论 -
PAT甲1006 Sign In and Sign Out (25)(25 分)
#include <stdio.h>#include <stdlib.h> #include <vector>#include <cstring>#include <queue>#include <string>#include <iostream>#include <algorith原创 2018-08-06 21:35:19 · 128 阅读 · 0 评论 -
PAT甲1033 To Fill or Not to Fill (25)(25 分)
#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;struct station{ double price; int st; int ed; bool flag;}sta[510];int pre[31000]...原创 2018-08-14 21:27:10 · 177 阅读 · 0 评论 -
PAT甲1034 Head of a Gang (30)(30 分)
#include &lt;stdio.h&gt;#include &lt;string.h&gt;#include &lt;iostream&gt;#include &lt;algorithm&gt;#include &lt;map&gt;#include &lt;string&gt;using names原创 2018-08-14 21:58:11 · 291 阅读 · 0 评论 -
PAT甲1022 Digital Library (30)(30 分)
#include <stdio.h>#include <iostream>#include <string>#include <map>#include <vector>#include <set>#include <algorithm>using namespace std;int N;str原创 2018-08-11 21:55:34 · 273 阅读 · 0 评论 -
PAT甲1023 Have Fun with Numbers (20)(20 分)
#include <stdio.h>#include <string.h>using namespace std;void doubleup(char a[],char b[]){ int c=0; int len=0; for(int i=strlen(a)-1;i>=0;i--) { b[len++]=((...原创 2018-08-11 22:23:29 · 119 阅读 · 0 评论 -
PAT甲1024 Palindromic Number (25)(25 分)
#include <stdio.h>#include <string.h>using namespace std;bool judge(char a[]){ int len=strlen(a); for(int i=0;i<len;i++) { if(a[i]!=a[len-i-1]) retu...原创 2018-08-11 22:33:48 · 106 阅读 · 0 评论 -
PAT甲1025 PAT Ranking (25)(25 分)
#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;struct student{ char id[20]; int score; int lrank; int trank; int loc;}stu[310...原创 2018-08-11 22:51:32 · 119 阅读 · 0 评论 -
PAT甲1026 Table Tennis (30)(30 分)
做了两轮了,模拟题还是这么费脑子哎#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;string.h&amp;gt;#include &amp;lt;algorithm&amp;gt;using namespace std;struct table{ int index; bool vip; int endtime;原创 2018-08-12 21:40:42 · 159 阅读 · 0 评论 -
PAT甲1035 Password (20)(20 分)
#include &lt;string.h&gt;#include &lt;stdio.h&gt;using namespace std;struct account{ char name[20]; char password[20]; bool flag; account() { flag=false; }}A[1100...原创 2018-08-15 19:41:20 · 162 阅读 · 0 评论 -
PAT甲1036 Boys vs Girls (25)(25 分)
#include <string.h>#include <stdio.h>#include <algorithm>using namespace std;struct student{ char gender; char name[20]; char ID[20]; int score;}stu[100010];...原创 2018-08-15 19:52:58 · 95 阅读 · 0 评论 -
PAT甲1037 Magic Coupon (25)(25 分)
#include <string.h>#include <stdio.h>#include <algorithm>using namespace std;int f1[100010];int f2[100010];int N,M;int main(){ scanf("%d",&N); for(int i=0;i<...原创 2018-08-15 20:09:30 · 130 阅读 · 0 评论 -
PAT甲1038 Recover the Smallest Number (30)(30 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>using namespace std;int N;string str[10010];bool judge(string a,str...原创 2018-08-15 20:29:58 · 130 阅读 · 0 评论 -
PAT甲1039 Course List for Student (25)(25 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>#include <vector>using namespace std;const int maxn=26*26*26*10...原创 2018-08-15 21:04:25 · 141 阅读 · 0 评论 -
PAT甲1040 Longest Symmetric String (25)(25 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>#include <vector>using namespace std;int dp[1100][1100];int m...原创 2018-08-15 21:14:11 · 242 阅读 · 0 评论 -
PAT甲1041 Be Unique (20)(20 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>#include <vector>using namespace std;int A[100010];int h[10010...原创 2018-08-15 21:18:11 · 167 阅读 · 0 评论 -
PAT甲1042 Shuffling Machine (20)(20 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>#include <vector>using namespace std;char H[5]={'S','H','C','D'...原创 2018-08-15 21:28:35 · 140 阅读 · 0 评论 -
PAT甲1043 Is It a Binary Search Tree (25)(25 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>#include <vector>using namespace std;struct node{ int data...原创 2018-08-15 21:55:14 · 141 阅读 · 0 评论 -
PAT甲1044 Shopping in Mars (25)(25 分)
#include <string.h>#include <stdio.h>#include <algorithm>#include <string>#include <iostream>#include <vector>using namespace std;int sum[100010];int N,K;...原创 2018-08-15 22:25:41 · 163 阅读 · 0 评论 -
PAT甲1007 Maximum Subsequence Sum (25)(25 分)
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>using namespace std;int N;int A[10010];int pre[10010];int st;int dp[10010];int main() { ...原创 2018-08-08 19:36:09 · 136 阅读 · 0 评论 -
PAT甲1008 Elevator (20)(20 分)
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>using namespace std;int main() { int totalsec=0; int n; scanf("%d",&n); i...原创 2018-08-08 19:41:18 · 135 阅读 · 0 评论 -
PAT甲1009 Product of Polynomials (25)(25 分)
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <map>#include <vector>#include <algorithm>using namespace std; st原创 2018-08-08 20:12:55 · 125 阅读 · 0 评论 -
PAT甲1011 World Cup Betting (20)(20 分)
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <map>#include <vector>#include <algorithm>using namespace std;in原创 2018-08-08 21:05:27 · 123 阅读 · 0 评论 -
PAT甲1010 Radix (25)(25 分)
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <map>#include <vector>#include <algorithm>using namespace std; ch原创 2018-08-08 21:08:19 · 136 阅读 · 0 评论 -
PAT甲1012 The Best Rank (25)(25 分)
#include <stdio.h>#include <map>#include <string>#include <algorithm>using namespace std;int N,M;struct student{ int index; char id[10]; int score[4]; c...原创 2018-08-08 21:40:13 · 108 阅读 · 0 评论 -
PAT甲1027 Colors in Mars (20)(20 分)
比较粗糙,懒得改了……#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;void change(int color,char A[]){ int len=0; if(color==0) { A[len++...原创 2018-08-13 20:37:20 · 91 阅读 · 0 评论 -
PAT甲1028 List Sorting (25)(25 分)
#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;struct student{ char id[10]; char name[10]; int grade;}stu[110000];bool cmp1(student a,stu...原创 2018-08-13 20:46:43 · 139 阅读 · 0 评论