- 博客(13)
- 资源 (1)
- 收藏
- 关注
原创 素数回文 HDU - 1431
#include <stdio.h>#include <math.h>#define MAX 9989899int list[100000];bool mark[9989900];int id = 0;void init(){ //这里的技巧是,2-100000000之间的最大素数回文数是9989899, int tmp = sqrt...
2018-09-08 11:26:58 189
转载 威佐夫博奕模板
https://www.cnblogs.com/chenhuan001/p/5735165.html //威佐夫博奕:有两堆各若干个物品,两个人轮流从某一堆或同时从两堆中取同样多的物品,规定每次至少取一个,多者不限,最后取光者得胜。//输入:两堆大小//返回:0表示必败,1表示必胜bool Wythoff(int n,int m){ if(n<m) swap(n,m...
2018-09-08 11:05:03 172
转载 大数乘法
https://blog.csdn.net/wang_1997/article/details/68241892#include <stdio.h>#include <cstring>#define maxn 1000char str1[maxn];char str2[maxn];int ans[2 * maxn];int tmp1[maxn];i...
2018-09-07 14:51:42 299
原创 继续畅通工程 HDU - 1879(最小生成树)
#include <stdio.h>#include <algorithm>using namespace std;struct Node{ int a, b; int w, s;}list[5000];bool cmp(Node x, Node y){ return x.w < y.w;}int t[110];...
2018-09-06 18:05:35 219
原创 Jungle Roads HDU - 1301(最小生成树-并查集)
#include <stdio.h>#include <algorithm>using namespace std;struct Node{ int a, b; int w;}list[100];int t[50];bool cmp(Node a, Node b){ return a.w < b.w;}int f...
2018-09-06 16:59:53 133
原创 How Many Tables HDU - 1213(并查集)
#include <stdio.h>int list[1010];int findRoot(int x){ if(list[x] == x) return x; int tmp = findRoot(list[x]); list[x] = tmp; return tmp;}int main(){ int k;...
2018-09-06 10:55:05 56
原创 Vertical Histogram HDU - 2708 (字符串以及二维字符数组的申请方式)
#include <stdio.h>#include <string.h>#include <stdlib.h>int list[26];int main(){ char* str = (char*)malloc(sizeof(char)*72); while(gets(str)) { memset(lis...
2018-09-04 20:10:19 117
原创 Remainder HDU - 1104 (BFS+输出路径)(未ac)
#include <stdio.h>#include <cstring>#include <queue>using namespace std;char dir[] = {'+', '*', '-', '%'};int n, k, m, km;struct Node{ int step; int x; int id;...
2018-09-04 11:11:07 90
原创 Gap HDU - 1067(BFS)(未ac)
#include <stdio.h>#include <cstring>#include <queue>using namespace std;struct Node{ int x, y;};int map[5][8];queue<Node> q;int BFS(){ int nx = 0, ny = 0...
2018-09-04 09:19:28 93
原创 Nightmare HDU - 1072 (BFS)
#include <stdio.h>#include <cstring>#include <queue>using namespace std;struct Node{ int x, y, time, ans;};queue<Node> q;int map[9][9];bool mark[9][9];int n,...
2018-09-02 11:21:15 131
原创 A计划 HDU - 2102 (BFS)(已ac,突然智障,)
#include <stdio.h>#include <cstring>#include <queue>using namespace std;int dir[][2] = {1,0, -1,0, 0,1, 0,-1};int n, m, t;bool mark[12][12][2];char map[12][12][2];struct...
2018-09-01 19:20:23 96
原创 FatMouse and Cheese HDU - 1078(DFS+DP)
/*参考网上的代码,,DFS+DP dp[x][y] = list[x][y] + max(所有下一步可以走的点的dp[nx][ny]) dp[0][0]是最终的答案,表示从起点到终点能吃的最大蛋糕数 因此,dp[x][y]是一个从终点到起点逆向递推的过程, */ #include <stdio.h>#include <algorithm>...
2018-09-01 16:33:11 171
原创 Cow Contest POJ - 3660 (传递闭包)
//本题找的是关系确定的元素个数,即一个元素与其他所有元素都有大小关系 #include <stdio.h>#include <cstring>int g[101][101];int main(){ int n, m, a, b; while(~scanf("%d%d", &n, &m)) { me...
2018-09-01 12:50:54 125
Udec600_64bit323.msi
2020-04-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人