Packets Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 41014 Accepted: 13776 Description A factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5, 6*6. These products are alway…
简单,两次排序 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 50000 struct Vote { int index; int a; int b; }; struct Vote candidates[MAX]; int N, K; int cmp_1(const void * a, const void * b) { return ((struct Vote *)b)-&…
排序, 遍历,需要裁减 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 20000 int cows[MAX]; int N; int L; int cmp(const void * a, const void * b) { return *(int *)a - *(int *)b; } int main() { int i; int j, k; int count; coun…
判断一个图是否是一个树,树满足一下2个条件即可:1. 边树比node数少12. 所有node的入度非0即1 节点数是0的时候,空树,合法树~ 代码如下 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 100 int matrix[MAX][MAX]; int node[MAX] = {0}; int N = 0; int M = 0; int check() { int i,…