随笔分类 - Vjudge
摘要:A - 青蛙的约会 https://oi-wiki.org/math/linear-equation/ #include<iostream> #include<cmath> using namespace std; long long ex_gcd(long long a, long long b,
阅读全文
摘要:A - Chips Moving #include<stdio.h> #include<map> #include<iostream> #include<algorithm> using namespace std; const int MAX=1e2+2; int x[MAX],n; /* 如果是
阅读全文
摘要:A - Prefixes #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const int MAX = 1e5+5
阅读全文
摘要:石子合并问题--直线版 HRBUST - 1818 注释的部分是平行四边形优化,下面是分析的草稿 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int INF = 0x3f3f3f3f
阅读全文
摘要:A - 今年暑假不AC #include<iostream> #include<string.h> #include<algorithm> #include<map> #include<stdio.h> #define MAXN 3000 using namespace std; struct no
阅读全文
摘要:A - Max Sum Plus Plus[排列组合] 这个真的很难搞,排列组合也太难了 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const
阅读全文
摘要:A - Coin Change[多重背包] #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> const int MONEY= 251; const int COIN = 101; using na
阅读全文
摘要:A - Binary Tree Traversals 记一个模板 #include<iostream> using namespace std; typedef struct Tree{ Tree *left; Tree *right; int value; }Tree; Tree *root; T
阅读全文
摘要:A - How Many Tables #include<iostream> using namespace std; const int maxn = 1050; int set[maxn]; void init_set() { for(int i=0;i<=maxn;++i)set[i]=i;
阅读全文
摘要:A - N皇后问题 #include<iostream> #include<cmath> #include<string.h> using namespace std; int n,tot=0; int col[12]={0}; bool check(int c,int r) { for(int i
阅读全文
摘要:A - 圆桌问题: HDU - 4841 #include<iostream> #include<vector> #include<stdio.h> #include<string> using namespace std; int main() { vector<int> table; int n
阅读全文
摘要:题目: 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多组数
阅读全文
摘要:题目: Problem DescriptionFor a group of people, there is an idea that everyone is equals to or less than 6 steps away from any other person in the group
阅读全文
摘要:打印从n个数的全排列: #include<iostream> #include<algorithm> #include<ctime> #define Swap(a,b) {int temp=a;a=b;b=temp;} using namespace std; int data[]={1,2,3,4
阅读全文
摘要:A - Red and Black There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile.
阅读全文
摘要:八数码求最短步数: #include<queue> #include<stdio.h> #include<iostream> #include<string.h> using namespace std; const int LEN = 362880; struct node { int state
阅读全文