摘要: 1016 Phone Bills #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; struct jilu { char name[25]; int mon 阅读全文
posted @ 2020-04-22 01:05 yoyoyayababy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 报数 #include<stdio.h> #include<stdlib.h> #include<string.h> int a[]={0,0,0,0}; int is7(int n) { if(n%7==0)return 1; char str[30]; sprintf(str,"%d",n); 阅读全文
posted @ 2020-04-19 23:43 yoyoyayababy 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 将军的书 #include<stdio.h> #include<math.h> int n; char page[25]; char result[25]={'0'}; int main() { scanf("%d",&n); int sum = pow(2,n); int i; for(i=0;i 阅读全文
posted @ 2020-04-17 00:19 yoyoyayababy 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 【PAT A1012】 The Best Rank (25分) 此题的坑点是,排名涉及并列名次,存在并列第一,并列第三的情况,计算排名时要特别考虑。 #include<stdio.h> #include<string.h> #include<stdlib.h> struct stu { char n 阅读全文
posted @ 2020-04-14 20:34 yoyoyayababy 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 【PAT A1013】Battle Over Cities #include<stdio.h> #include<stdlib.h> #include<string.h> const int maxv = 1005; int vis[maxv] = {0}; int g[maxv][maxv]; i 阅读全文
posted @ 2020-03-15 01:23 yoyoyayababy 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 【PAT1006】 Sign In and Sign Out 考察点在于qsort函数cmp的写法。 #include<stdio.h> #include<stdlib.h> char name[16][100]; struct stu { char name[16]; int h1,m1,s1; 阅读全文
posted @ 2020-03-14 13:57 yoyoyayababy 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 【PAT A1086】 Tree Traversals Again #include<stdio.h> #include<string.h> #include<stdlib.h> struct node { struct node* lchild; struct node* rchild; int 阅读全文
posted @ 2020-03-10 00:30 yoyoyayababy 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 二叉树的存储 struct node { typename data; node* lchild; node* rchild; }; node* root = NULL; node* newNode(int v) { node* Node = new node; Node->data = v; No 阅读全文
posted @ 2020-03-07 15:18 yoyoyayababy 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Dikjstra算法 // #include<limits.h> const int INF = INT_MAX; const int maxv = 1000; int n,g[maxv][maxv]; int d[maxv]; bool vis[maxv] = {false}; void dij( 阅读全文
posted @ 2020-03-02 21:32 yoyoyayababy 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 6-10 二分查找 注意notfound的用法 Position BinarySearch( List L, ElementType x ) { int left = 1; int right = L->Last; while(left <= right) { int mid = (left + r 阅读全文
posted @ 2020-03-01 21:00 yoyoyayababy 阅读(233) 评论(0) 推荐(0) 编辑