摘要:
题目2 : 赛车时间限制:20000ms单点时限:1000ms内存限制:256MB描述幻想乡有一个赛车场。赛车场里有N个地点。同时地点之间还有单向的道路存在。这些道路使得赛车场形成了一个外向树的结构。也就是说,道路将这N个地点连成了一个有根树。并且所有的边都是从父亲指向孩子的。由于幽香喜欢刺激,每次... 阅读全文
随笔档案-2015年08月
hihoCoder挑战赛14 题目1 : 不等式
2015-08-30 21:00 by iun, 491 阅读, 收藏,
摘要:
题目1 : 不等式时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定n个关于X的不等式,问最多有多少个成立。每个不等式为如下的形式之一:X CX >= C输入第一行一个整数n。以下n行,每行一个不等式。数据范围:1 0样例输出2这题没说C是整数,但是提交代码把C当成整数可以... 阅读全文
poj 3074,搜索枝剪
2015-08-26 16:21 by iun, 324 阅读, 收藏,
摘要:
SudokuTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8909Accepted: 3196DescriptionIn the game of Sudoku, you are given a large 9 × 9 grid di... 阅读全文
sudoku,数独,poj2676
2015-08-26 11:22 by iun, 173 阅读, 收藏,
摘要:
每次从状态数最小的位置开始搜索#include #include using namespace std;int g[9][9];int row[9][10];int col[9][10];int cell[9][10];int getId(int x,int y){ return (x/3)... 阅读全文
子集枚举
2015-08-25 22:27 by iun, 239 阅读, 收藏,
摘要:
#include #include #include using namespace std;//枚举包含n个元素的集合中大小是k的子集void subset_n_k(int n,int k){ int sub = 1; int end_state; for(int i= 1;i>... 阅读全文
组合数生成算法
2015-08-25 22:02 by iun, 541 阅读, 收藏,
摘要:
#include #include #include using namespace std;bool next_combination(vector& vec,int n){ int k = vec.size() - 1; for(;k>=0;k--){ if(vec[k... 阅读全文
全排列生成算法
2015-08-25 21:25 by iun, 294 阅读, 收藏,
摘要:
全排列的生成算法, next_permutation_1可以用于生成多重集的全排列,next_permutation_2不能用于多重集#include #include #include using namespace std;bool next_permutation_1(vector& vec)... 阅读全文
第k个排列数
2015-08-25 20:47 by iun, 341 阅读, 收藏,
摘要:
变长编码,这里排列的序号是0到n!-1,假设求 1,2,3,4的第15个排列数,15/(3!) = 2,余数是3,第一个数是(1,2,3,4)中的第二个数 3 (这里0是开始位置),3/(2!) = 1,余数是1,第二个数就是(1,2,4)中的第一个数 2, 1/(1!) = 1,余数是0,第三个数... 阅读全文
编程之美复赛,运输货物,hihocoder 1168
2015-08-22 21:13 by iun, 382 阅读, 收藏,
摘要:
题目1 : 运输货物时间限制:2000ms单点时限:1000ms内存限制:256MB描述Z国有n个城市,编号为1, 2, …, n。城市间通过n – 1条道路相连,任意两个城市间有且仅有一条路径可以相互到达。每个城市都有一些货物,政府希望将所有的货物运送到港口城市s以便出口。由于交通条件限制, 每一... 阅读全文
Suzhou Adventure,hihocoder 1104
2015-08-16 21:09 by iun, 228 阅读, 收藏,
摘要:
时间限制:10000ms单点时限:1000ms内存限制:256MB描述Little Hi is taking an adventure in Suzhou now. There are N beautiful villages in Suzhou which are numbered from 1 ... 阅读全文
Google 2015 apac test Problem A, Seven-segment Display
2015-08-16 20:29 by iun, 420 阅读, 收藏,
摘要:
Problem A. Seven-segment Display This contest is open for practice. You can try every problem as many times as you like, though we won't keep track of... 阅读全文
浙公网安备 33010602011771号