- 博客(12)
- 收藏
- 关注
原创 D2. Equalizing by Division (hard version)
The only difference between easy and hard versions is the number of elements in the array.You are given an array a consisting of n integers. In one move you can choose any ai and divide it by 2 round...
2019-08-31 10:29:26 870
原创 D1. Equalizing by Division (easy version)
The only difference between easy and hard versions is the number of elements in the array.You are given an array a consisting of n integers. In one move you can choose any ai and divide it by 2 round...
2019-08-31 09:51:49 794
原创 问题 F: Fansblog(威尔逊定理+Miller-Rabin素数检测算法)
题目描述Farmer John keeps a website called ‘FansBlog’ .Everyday , there are many people visited this blog.One day, he find the visits has reached P , which is a prime number.He thinks it is a interesting...
2019-08-25 17:58:37 184
原创 P4549 【模板】裴蜀定理
题目描述给出n个数(A1…An)现求一组整数序列(X1…Xn)使得S=A1X1+…AnXn>0,且S的值最小输入格式第一行给出数字N,代表有N个数 下面一行给出N个数输出格式S的最小值输入输出样例输入 #1 复制24059 -1782输出 #1 复制99说明/提示对于100%的数据,1 \le n \le 201≤n≤20,|x_i| \le 100000∣xi...
2019-08-14 17:53:46 91
原创 Farey Sums(欧拉函数)
题目描述Given a positive integer, N, the sequence of all fractions a/b with (0 < a ≤ b), (1 < b ≤ N) and a and b relatively prime, listed in increasing order, is called the Farey Sequence of order ...
2019-08-13 19:33:54 250
原创 Cow Contest(POJ3660)
题目:Cow Contest思路:先用floyd求出有向图每两个点之间是否有关系,然后统计强于这个结点的有x个,再统计弱于这个结点的有y个,假如这个结节排第几能确定的话,肯定有x+y == n-1#include <stdio.h>const int N = 1e+4;int dp[N][N];int n,m;void floyd(){ for(int k = 1;k...
2019-08-11 17:05:29 144
原创 过山车
题目:过山车匈牙利算法模板题#include <stdio.h>#include <string.h>int G[505][505];int k,n,m;int pre[505],vis[505];int find(int x){ for(int i = 1;i <= m;i++){ if(G[i][x]&&vis[i] == ...
2019-08-09 09:32:43 151
原创 Degree Sequence of Graph G(Havel定理)
Wang Haiyang is a strong and optimistic Chinese youngster. Although born and brought up in the northern inland city Harbin, he has deep love and yearns for the boundless oceans. After graduation, he c...
2019-08-06 18:27:01 812
原创 Constructing Roads(POJ2421)
题目:Constructing Roads思路:将已经走过的标记为0,然后使用kruskal模板#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;const int inf = 0x3f;struct str{ int x; int y;...
2019-08-05 15:37:58 175
原创 MPI Maelstrom(POJ1502)
题目:MPI Maelstrom思路:用Dijkstra模板ps:数组的范围需要注意一下,输入也需要注意一下#include <stdio.h>#include <queue>#include <iostream>using namespace std;typedef pair<int,int>P;const int N = 200;...
2019-08-05 13:22:11 164
原创 Give Candies(费马小定理)
There are N children in kindergarten. Miss Li bought them N candies. To make the process more interesting, Miss Li comes up with the rule: All the children line up according to their student number (1...
2019-08-02 19:57:03 277
原创 还是畅通工程(HDOJ1233)+Kruskal
思考:用kruskal算法,要学会并查集#include <stdio.h>#include <iostream>#include <algorithm>#include <string.h>using namespace std;struct node{ int dis; int s; int t;}a[5005];int ...
2019-08-01 16:02:00 160
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人