2019年5月22日

2016蓝桥杯决赛 机器人塔(会超时)

摘要: #include using namespace std; const int maxn = 500 + 3; int M[maxn][maxn]; int num[2]; int sum; void dfs(int r, int c) { if(c > r) return; if(num[0] > num[0] >> num[1]; sum = 0; M[... 阅读全文

posted @ 2019-05-22 21:29 nbsanshi 阅读(127) 评论(0) 推荐(0) 编辑

2019年4月10日

Guess UVALive - 4255

摘要: 题意: 定义数组A的“符号矩阵”F,F[i][j]表示A[i] + A[i+1] + ... + A[j]。 已知F,给出A的一个可能解。 分析: 1. 利用前缀和。F[i][j[ 表示 S[j] - S[i-1]。 2. 问题转化为已知 S[0] S[1] ... S[n] 的大小关系,并且已知 阅读全文

posted @ 2019-04-10 21:34 nbsanshi 阅读(70) 评论(0) 推荐(0) 编辑

uva10047(未AC)

摘要: #include using namespace std; struct Node{ int x, y, d, c; Node(int x = 0, int y = 0, int d = 0, int c = 0):x(x), y(y), d(d), c(c){} bool operator==(const Node& node)const{ retur... 阅读全文

posted @ 2019-04-10 20:20 nbsanshi 阅读(78) 评论(0) 推荐(0) 编辑

2019年4月8日

Fire! UVA - 11624

摘要: #include using namespace std; struct Node{ int r, c, dis; Node(int r, int c):r(r), c(c){} }; const int maxn = 1000 + 3; int R, C; char maze[maxn][maxn]; int fire[maxn][maxn]; int vis[maxn][... 阅读全文

posted @ 2019-04-08 20:44 nbsanshi 阅读(73) 评论(0) 推荐(0) 编辑

2019年3月21日

UVA - 10003 Cutting Sticks(动态规划)

摘要: #include #include using namespace std; const int maxn = 50 + 3; int l, n; int c[maxn]; int dp[maxn][maxn]; int vis[maxn][maxn]; int solve2(int i, int j) { if(i == j - 1) return 0; if(vis[i]... 阅读全文

posted @ 2019-03-21 21:10 nbsanshi 阅读(111) 评论(0) 推荐(0) 编辑

2019年3月20日

Ping pong UVALive - 4329

摘要: #include<iostream> #include<cstring> #include<cstdio> #include<vector> using namespace std; const int maxn = 20000 + 3; int a[maxn], c[maxn], d[maxn]; 阅读全文

posted @ 2019-03-20 09:09 nbsanshi 阅读(143) 评论(0) 推荐(0) 编辑

2019年3月17日

201803-3 URL映射(50)

摘要: #include<bits/stdc++.h> using namespace std; const int maxn = 100 + 3; const int maxm = 100 + 3; int n, m; struct Node{ string s; string name; vector< 阅读全文

posted @ 2019-03-17 19:08 nbsanshi 阅读(118) 评论(0) 推荐(0) 编辑

2019年3月15日

UVA - 658_It's not a Bug, it's a Feature! (用map超时,改用位运算完美哈希)

摘要: #include<bits/stdc++.h> using namespace std; typedef pair<int,string>Pair; const int maxn = 20 + 3; const int maxm = 100 + 3; int n, m; struct Edge{ s 阅读全文

posted @ 2019-03-15 11:11 nbsanshi 阅读(76) 评论(0) 推荐(0) 编辑

2019年3月13日

UVA - 10870 Recurrences

摘要: #include using namespace std; const int maxd = 100 + 4; int d, n, m; typedef long long Matrix[maxd][maxd]; typedef long long Vector[maxd]; Vector a, f; //务必秉承不修改原变量的思想。因此开辟t这个辅助空间。 //因为有可能R和A都是指向... 阅读全文

posted @ 2019-03-13 21:44 nbsanshi 阅读(74) 评论(0) 推荐(0) 编辑

2019年3月12日

201812-3 CIDR合并(80)

摘要: #include #define _for(i,a,b) for(int i=a;iips; IP getIP(string& ip) { for(int i = 0; i > a >> b >> c >> d >> n; return IP(a, b, c, d, n); } void insertToIPList(string& s) { string ss = s... 阅读全文

posted @ 2019-03-12 11:16 nbsanshi 阅读(193) 评论(0) 推荐(0) 编辑

导航