03 2019 档案

摘要:L2-032 彩虹瓶 (25 分) L2-032 彩虹瓶 (25 分) L2-032 彩虹瓶 (25 分) 彩虹瓶的制作过程(并不)是这样的:先把一大批空瓶铺放在装填场地上,然后按照一定的顺序将每种颜色的小球均匀撒到这批瓶子里。 假设彩虹瓶里要按顺序装 N 种颜色的小球(不妨将顺序就编号为 1 到 阅读全文
posted @ 2019-03-31 10:35 Coodyzのblog 阅读(2113) 评论(0) 推荐(3)
摘要:L2-019 悄悄关注 (25 分) L2-019 悄悄关注 (25 分) L2-019 悄悄关注 (25 分) 新浪微博上有个“悄悄关注”,一个用户悄悄关注的人,不出现在这个用户的关注列表上,但系统会推送其悄悄关注的人发表的微博给该用户。现在我们来做一回网络侦探,根据某人的关注列表和其对其他用户的 阅读全文
posted @ 2019-03-27 16:28 Coodyzのblog 阅读(221) 评论(0) 推荐(0)
摘要:1 int search(int t) 2 { 3 if(满足输出条件) 4 { 5 输出解; 6 } 7 else 8 { 9 for(int i=1;i<=尝试方法数;i++) 10 if(满足进一步搜索条件) 11 { 12 ... 阅读全文
posted @ 2019-03-25 21:49 Coodyzのblog 阅读(144) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define OVERFLOW 3 9 using namespace std; 10 typedef char TElemType; 11 TElemType ch; 12 typedef st... 阅读全文
posted @ 2019-03-25 21:46 Coodyzのblog 阅读(182) 评论(0) 推荐(0)
摘要:拓扑排序算法主要是循环执行以下两步,直到不存在入度为0的顶点为止。 (1) 选择一个入度为0的顶点并输出之; (2) 从网中删除此顶点及所有出边。 循环结束后,若输出的顶点数小于网中的顶点数,则输出“有回路”信息,否则输出的顶点序列就是一种拓扑序列。 输入 第一行输入两个整数n和m,n表示途中节点数,m表示途中边数;接下来输入m行,每一行有两个整数v1和v2,v1和v... 阅读全文
posted @ 2019-03-25 21:43 Coodyzのblog 阅读(191) 评论(0) 推荐(0)
摘要:int gys(int m, int n){ return n == 0 ? m : gys(n, m % n); } 阅读全文
posted @ 2019-03-25 21:42 Coodyzのblog 阅读(634) 评论(0) 推荐(0)
摘要:#include #include using namespace std; void Prim(int list[],int n) { int num=1,a=0,b=0; for(int i=n;i>0;i--) num*=i; while(num--) { for(int i=0;i0;--i){ if... 阅读全文
posted @ 2019-03-25 21:41 Coodyzのblog 阅读(141) 评论(0) 推荐(0)
摘要:1 priority_queue, cmp > q2; 2 struct cmp{ 3 bool operator () (const int &a, const int &b){ 4 return a>b; 5 } 6 }; 7 8 9 10 #include 11 using namespace std; 12 13 struct... 阅读全文
posted @ 2019-03-25 21:39 Coodyzのblog 阅读(116) 评论(0) 推荐(0)
摘要:int find(int x){ if(x==pre[x]) return x; return pre[x]=find(pre[x]); } void unite(int x,int y){ x=find(x); y=find(y); if(x!=y) pre[x]=y; } void is_connect(){//if cnt == 1 :连通集 ... 阅读全文
posted @ 2019-03-25 21:39 Coodyzのblog 阅读(140) 评论(0) 推荐(0)
摘要:#include <iomanip> cout<<setw(9)<<left<<a<<"#"<<endl;//占位9个字符 ~~~ 左对齐 cout<<setiosflags(ios::fixed)<<setprecision(2)<<a; // ~~~ 保留两位小数 阅读全文
posted @ 2019-03-25 21:38 Coodyzのblog 阅读(104) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 const int INF = 100000000; 5 const int maxn = 10000; 6 typedef pair P; //储存坐标下x,y 7 int maze[maxn][maxn]; 8 int d[maxn][maxn]; //储... 阅读全文
posted @ 2019-03-25 21:36 Coodyzのblog 阅读(142) 评论(0) 推荐(0)
摘要:例:hnitoj_1490 阅读全文
posted @ 2019-03-25 21:34 Coodyzのblog 阅读(143) 评论(0) 推荐(0)
摘要:巴什博弈: 一堆物品,规定每次取物品的个数是[1,m],最后取尽物体的一方赢。 策略分析:如果n=m+1,那么由于一次最多取m个物品,所以无论先取者拿走多少, 后取者都能一次性拿走剩余的物品,后者取胜。因此我们发现取胜的法则是: 如果n=(m+1)*r+s (r为任意自然数,s<=m),那么先取者要 阅读全文
posted @ 2019-03-25 21:33 Coodyzのblog 阅读(375) 评论(0) 推荐(0)
摘要:L1-008 建立与遍历二叉树 (20 分) 以字符串的形式定义一棵二叉树的先序序列,若字符是‘#’, 表示该二叉树是空树,否则该字符是相应结点的数据元素。读入相应先序序列,建立二叉链式存储结构的二叉树,然后中序遍历该二叉树并输出结点数据。 输入格式: 字符串形式的先序序列(即结点的数据类型为单个字 阅读全文
posted @ 2019-03-24 19:23 Coodyzのblog 阅读(2468) 评论(0) 推荐(0)
摘要:2.1 变量、名字和对象 变量名字不允许以数字开头。此外,Pthon中以下划线开头的名字有特殊的含义。 2.2.1 整数 同时得到商和余数 2.2.3 基数 0b或0B代表二进制 0o或0O代表八进制 ox或oX代表十六进制 2.2.5 int 型大小 在python2梨,一个int 型包含32为, 阅读全文
posted @ 2019-03-11 23:35 Coodyzのblog 阅读(144) 评论(0) 推荐(0)