chenxi16

导航

04 2020 档案

PAT (Basic Level) Practice (中文) 1026 程序运行时间
摘要:#include<stdio.h> #include<math.h> using namespace std; int main(){ int c1,c2,h,m,s; int c; scanf("%d %d",&c1,&c2); c = (c2-c1); h = c / (3600*100); m 阅读全文

posted @ 2020-04-18 18:19 chenxi16 阅读(103) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1024 科学计数法
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 const int maxn = 100000; 6 char a[maxn]; 7 int main(){ 8 int e 阅读全文

posted @ 2020-04-16 15:51 chenxi16 阅读(183) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文)1023 组个最小数
摘要:1 #include<stdio.h> 2 #include<algorithm> 3 #include<string.h> 4 using namespace std; 5 const int maxn = 50; 6 int main(){ 7 int a[10],count=0,value; 阅读全文

posted @ 2020-04-16 15:06 chenxi16 阅读(101) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1020 月饼
摘要:1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 const int MAXN=1001; 5 struct kind{ 6 double num,price,p_price; 7 }; 8 int d,n; 9 s 阅读全文

posted @ 2020-04-16 10:51 chenxi16 阅读(142) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1019 数字黑洞
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 char n[5]; 6 bool cmp(char a,char b){//降序 7 return a>b; 8 } 9 阅读全文

posted @ 2020-04-15 11:17 chenxi16 阅读(137) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1018 锤子剪刀布
摘要:1 #include<stdio.h> 2 3 // c:0 j:1 b:2 0:胜 1:平 2:负 4 int n,p1[3],p2[3],num[3]; 5 6 void read(); 7 void deal(int x,int y); 8 int change(char a); 9 char 阅读全文

posted @ 2020-04-15 10:02 chenxi16 阅读(134) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1017 A除以B
摘要:1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 const int MAXN=1001; 5 char a[MAXN]; 6 int b; 7 int q[MAXN],r[MAXN]; 8 void read(); 9 阅读全文

posted @ 2020-04-14 17:16 chenxi16 阅读(116) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文)1016 部分A+B
摘要:1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 const int MAXN=13; 5 char a[MAXN],b[MAXN]; 6 char da,db; 7 void read(); 8 long long in 阅读全文

posted @ 2020-04-14 16:48 chenxi16 阅读(128) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1014 福尔摩斯的约会
摘要:1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 const int MAXN = 65; 5 char a[MAXN],b[MAXN]; 6 int main(){ 7 int day,h,m,count=0,len=0 阅读全文

posted @ 2020-04-14 15:05 chenxi16 阅读(143) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1013 数素数
摘要:1 #include<cstdio> 2 #include<cmath> 3 using namespace std; 4 5 const int MAXN = 100000000; 6 int a[MAXN]; 7 bool isprime(int x); 8 int main(){ 9 int 阅读全文

posted @ 2020-04-14 00:37 chenxi16 阅读(166) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1012 数字分类
摘要:1 #include<cstdio> 2 using namespace std; 3 int num[5],sumn[5],n; 4 void init(); 5 void read(); 6 void deal(); 7 int main(){ 8 init(); 9 read(); 10 de 阅读全文

posted @ 2020-04-14 00:13 chenxi16 阅读(126) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文)1011 A+B 和 C
摘要:1 #include<cstdio> 2 using namespace std; 3 int t; 4 int main(){ 5 long long int a,b,c; 6 scanf("%d",&t); 7 for(int i=1;i<=t;i++){ 8 scanf("%lld %lld 阅读全文

posted @ 2020-04-13 23:49 chenxi16 阅读(90) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1010 一元多项式求导
摘要:1 #include<stdio.h> 2 #define MAXN 100000 3 struct poly{ 4 int exp,var; 5 }; 6 struct poly a[MAXN]; 7 void read(); 8 void deal(); 9 void print(); 10 i 阅读全文

posted @ 2020-04-13 23:41 chenxi16 阅读(123) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1009 说反话
摘要:提交后最后一项本来不通过,但是更改条件后(见注释)结果就成功了,可见不一定单词里边只有A-Z,a-z,还有其他的内容。 1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 100 4 char a[MAXN]; 5 int main(){ 阅读全文

posted @ 2020-04-13 20:20 chenxi16 阅读(106) 评论(0) 推荐(0)

1008 数组元素循环右移问题
摘要:1 #include<stdio.h> 2 #define MAXN 102 3 int n,a[MAXN],m; 4 int main(){ 5 scanf("%d %d",&n,&m); 6 int i,j; 7 for(i=0;i<n;i++) scanf("%d",&a[i]); 8 if( 阅读全文

posted @ 2020-04-13 19:42 chenxi16 阅读(79) 评论(0) 推荐(0)

数据结构01- 09-排序3 Insertion or Heap Sort
摘要:#include<stdio.h> #define MAXN 102 int A[MAXN],a[MAXN],p[MAXN],n; void read(); void init(int a[]); int test(int a[],int b[]); int insertion_sort(int a 阅读全文

posted @ 2020-04-13 19:25 chenxi16 阅读(129) 评论(0) 推荐(0)

数据结构01- 09-排序2 Insert or Merge
摘要:1 #include<stdio.h> 2 #define MAXN 102 3 int n,a[MAXN],p[MAXN],A[MAXN]; 4 void read(); 5 int insertion_sort(); 6 void merge_sort(); 7 void merge_pass( 阅读全文

posted @ 2020-04-13 16:39 chenxi16 阅读(106) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文)1003 我要通过!
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 101 4 int find(char a[],char c); 5 int test(char a[]); 6 int main(){ 7 int n,i; 8 char a[MAXN] 阅读全文

posted @ 2020-04-09 16:38 chenxi16 阅读(114) 评论(0) 推荐(0)

PAT (Basic Level) Practice (中文) 1002 写出这个数
摘要:读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。 1 #include<stdio.h> 2 int main(){ 3 char c; 4 int sumt=0,t[10],count,i; 5 scanf("%c",&c); 6 while(c!='\0'&&c!='\n' 阅读全文

posted @ 2020-04-07 10:59 chenxi16 阅读(171) 评论(0) 推荐(0)

数据结构1-05-树9 Huffman Codes
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 1001 4 struct node{ 5 int data,left,right,parent; 6 node(){ 7 data = -1; 8 left = -1; 9 right= 阅读全文

posted @ 2020-04-06 17:46 chenxi16 阅读(127) 评论(0) 推荐(0)

数据结构1 - 01-复杂度1 最大子列和问题
摘要:1 #include<stdio.h> 2 #define MAXK 1000000 3 int a[MAXK],dp[MAXK],k; 4 int main(){ 5 int i,maxsum; 6 scanf("%d",&k); 7 for(i=0;i<k;i++){ 8 scanf("%d", 阅读全文

posted @ 2020-04-06 10:02 chenxi16 阅读(180) 评论(0) 推荐(0)

数据结构-1 01-复杂度2 Maximum Subsequence Sum
摘要:1 #include<stdio.h> 2 #define MAXK 10001 3 int k,a[MAXK],dp[MAXK],start[MAXK],end[MAXK]; 4 int main(){ 5 int i,j; 6 scanf("%d",&k); 7 for(i=0;i<k;i++) 阅读全文

posted @ 2020-04-06 09:49 chenxi16 阅读(181) 评论(0) 推荐(0)

数据结构1 - 08-图9 关键活动
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 101 4 struct edge{ 5 int v,e,l,time; 6 }; 7 struct adjs{ 8 struct edge ed[MAXN]; 9 struct edge 阅读全文

posted @ 2020-04-05 22:54 chenxi16 阅读(225) 评论(0) 推荐(0)

数据结构1 - 08-图8 How Long Does It Take
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 100 4 #define INF 0x3fffffff 5 int n,m,g[MAXN][MAXN],indegree[MAXN],ve[MAXN]; 6 void read(); 7 阅读全文

posted @ 2020-04-05 20:24 chenxi16 阅读(146) 评论(0) 推荐(0)

数据结构1 - 08-图7 公路村村通
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 1001 4 #define INF 0x3fffffff 5 int n,m,g[MAXN][MAXN],vis[MAXN],dist[MAXN]; 6 void read(); 7 i 阅读全文

posted @ 2020-04-05 19:26 chenxi16 阅读(275) 评论(0) 推荐(0)

数据结构1 - 07-图6 旅游规划
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 502 4 #define INF 0x3fffffff 5 int n,m,s,d; 6 int g[MAXN][MAXN],vis[MAXN],weight[MAXN][MAXN],d 阅读全文

posted @ 2020-04-05 18:01 chenxi16 阅读(286) 评论(0) 推荐(0)

数据结构1 - 07-图4 哈利·波特的考试
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 101 4 #define INF 0x3fffffff 5 6 int g[MAXN][MAXN],n,m,dist[MAXN],result[MAXN],vis[MAXN]; 7 vo 阅读全文

posted @ 2020-04-05 17:43 chenxi16 阅读(204) 评论(0) 推荐(0)

数据结构1 -06-图3 六度空间
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 1004 4 int g[MAXN][MAXN]; 5 int n,m; 6 int queue[MAXN*10000],front,rear; 7 void read(); 8 void 阅读全文

posted @ 2020-04-05 16:25 chenxi16 阅读(386) 评论(0) 推荐(0)

数据结构1 07-图5 Saving James Bond - Hard Version
摘要:1 #include<stdio.h> 2 #include<math.h> 3 #define MAXN 102 4 #define INF 1000000000 5 struct pos{ 6 int x,y; 7 }; 8 struct edge{ 9 int v1,v2; 10 }; 11 阅读全文

posted @ 2020-04-05 11:48 chenxi16 阅读(144) 评论(0) 推荐(0)

数据结构1 - 06-图2 Saving James Bond - Easy Version
摘要:1 #include<stdio.h> 2 #include<math.h> 3 #define MAXN 102 4 struct pos{ 5 int x,y; 6 }; 7 struct pos p[MAXN]; 8 int n,d,flag; 9 int g[MAXN][MAXN],vis[ 阅读全文

posted @ 2020-04-04 20:53 chenxi16 阅读(179) 评论(0) 推荐(0)

数据结构1 - 06-图1 列出连通集
摘要:1 #include<stdio.h> 2 #define MAXN 10 3 int g[MAXN][MAXN],vis[MAXN],n,e; 4 void init(); 5 void read(); 6 void BFS(int x); 7 void DFS(int x); 8 int mai 阅读全文

posted @ 2020-04-04 17:16 chenxi16 阅读(213) 评论(0) 推荐(0)

数据结构1 - 05-树8 File Transfer
摘要:1 #include<stdio.h> 2 #define MAXN 10001 3 int a[MAXN],root[MAXN]; 4 int getfather(int x); 5 int main(){ 6 int i,a1,a2,fa1,fa2,ch; 7 char op; 8 scanf( 阅读全文

posted @ 2020-04-04 13:59 chenxi16 阅读(144) 评论(0) 推荐(0)

数据结构1 - 05-树7 堆中的路径
摘要:1 #include<stdio.h> 2 #define MAXN 1002 3 int H[MAXN],N,M,r[MAXN]; 4 void inserth(int data); 5 void read(); 6 void printr(); 7 int main(){ 8 read(); 9 阅读全文

posted @ 2020-04-04 11:38 chenxi16 阅读(146) 评论(0) 推荐(0)

数据结构1 - 04-树4 是否同一棵二叉搜索树
摘要:测试根据不同的输入顺序是否为同一棵二叉搜索树。其中树的结点数小于等于10,而且树的数字为1-n。 1 #include<stdio.h> 2 #define MAXN 11 3 struct node{ 4 int left,right; 5 }; 6 struct node A[MAXN],B[M 阅读全文

posted @ 2020-04-03 18:00 chenxi16 阅读(197) 评论(0) 推荐(0)

数据结构1 04-树6 Complete Binary Search Tree
摘要:1 #include<stdio.h> 2 #define MAXN 1001 3 int n,a[MAXN],b[MAXN],c[10]; 4 void read(); 5 void sort(); 6 void cbt(int len,int pos,int start); 7 int main 阅读全文

posted @ 2020-04-03 17:15 chenxi16 阅读(131) 评论(0) 推荐(0)

数据结构1 - 04-树5 Root of AVL Tree
摘要:1 #include<stdio.h> 2 #include<math.h> 3 #define MAXN 1000 4 struct node{ 5 int left,right,data,height,parent; 6 }; 7 struct node a[MAXN]; 8 int n; 9 阅读全文

posted @ 2020-04-02 19:53 chenxi16 阅读(163) 评论(0) 推荐(0)

数据结构1 - 03-树3 Tree Traversals Again
摘要:1 #include<stdio.h> 2 #define MAXN 31 3 int a[MAXN],n,flag[MAXN]; 4 void deal(); 5 int main(){ 6 scanf("%d",&n); 7 a[0] = n; 8 flag[0] = n; 9 deal(); 阅读全文

posted @ 2020-04-01 17:37 chenxi16 阅读(187) 评论(0) 推荐(0)

数据结构-1 03-树2 List Leaves
摘要:1 #include<stdio.h> 2 #define MAXN 10 3 struct node{ 4 int left,right; 5 }; 6 struct node a[MAXN]; 7 int n,leavesnum,r; 8 void showleave(); 9 void rea 阅读全文

posted @ 2020-04-01 13:15 chenxi16 阅读(183) 评论(0) 推荐(0)

数据结构-1 03-树1 树的同构
摘要:1 #include<stdio.h> 2 struct node{ 3 char data; 4 int left,right; 5 }; 6 struct node a[11],b[11]; 7 int Na,Nb,ra,rb,flag; 8 int read(struct node a[],i 阅读全文

posted @ 2020-04-01 12:28 chenxi16 阅读(187) 评论(0) 推荐(0)

数据结构 02-线性结构4 Pop Sequence
摘要:刚开始拿到这道题的时候错误的做法: 1 //相邻之间的数小于等于M 2 //首先弹出来的数小于等于M 3 #include<stdio.h> 4 #include<math.h> 5 #define MAXN = 1000000; 6 int M,N,K; 7 int main(){ 8 int p 阅读全文

posted @ 2020-04-01 10:19 chenxi16 阅读(149) 评论(0) 推荐(0)