- 博客(21)
- 问答 (1)
- 收藏
- 关注
原创 POJ-棋盘问题(DFS)
#include<iostream> #include<cstring> #include<string> using namespace std; int visited[9]; int K,N,counts,way; char map[9][9]; void dfs(int k) { if (way == K) { counts++; return...
2018-05-26 17:25:34
397
原创 杭电OJ-Tickets(dp水题)
#include<iostream> #include<cstring> #include<algorithm> using namespace std; int one[2111]; int two[2111]; int dp[2111];//dp[i]=min(dp[i-1]+one[i],dp[i-2]+two[i]) void print_time(in...
2018-04-09 17:43:43
382
原创 杭电OJ-Max Sum&&Max Sum Plus Plus(DP)
#include<iostream>//d[i]=max(d[i-1]+a[i],a[i]),a[i]要么是以第i个结尾的头,要么是以第i个结尾的尾 #include<cstring> #include<algorithm> #define inf 0x3f3f3f3f using namespace std; int a[100001]; int dp[100...
2018-04-09 09:07:59
276
原创 百练OJ-迷宫问题(记录BFS的路径,两个方法,最好用栈,不用栈可能会有bug,虽然也可以AC....)
#include<iostream> #include<algorithm> #include<queue> #include<cstring> #include<stack> using namespace std; int a[7][7]; struct node { int x; int y; //int pastx; //...
2018-04-08 21:53:57
394
原创 杭电-max sum
#include<iostream> #include<cstring> #include<algorithm> #define inf 0x3f3f3f3f using namespace std; int a[100001]; int dp[100001]; int main() { int t; int n; cin >> t; for...
2018-04-08 20:49:19
300
原创 百练OJ-昂贵的聘礼
思路:输入n个结点,手动添加一个n+1结点,n+1节点到i节点的距离代表直接购买物品的花费,从j结点到k节点的距离代表物品k用j换的花费。输入数据时候判断物品的等级是否在酋长等级的【+-m】内,在的话才添加,不然就还是inf。dijkstra内更新距离时判断和之前所有添加过的点的等级与最小点等级的差是否满足条件。#include<iostream> #include<cstrin...
2018-04-05 20:25:38
301
原创 百练OJ-丛林中的路
#include<iostream>//PRIM版 #include<cstring> #define inf 0x3f3f3f3f using namespace std; int forest[30][30]; int dis[30]; bool vis[30]; int num; void prim() { int result = 0; for (int i ...
2018-04-02 18:54:04
417
原创 百练OJ-Dungeon Master(BFS)
#include<iostream> #include<cstring> #include<math.h> #include<algorithm> #include<array> #include<queue> using namespace std; array<array<array<char,
2018-04-02 10:38:58
278
原创 百练OJ-文件结构“图”
#include<iostream> #include<string> #include<set> #include<vector> using namespace std; int cengshu = 0; vector<string>result; void processdir(string dir) { string input...
2018-04-01 21:43:23
411
原创 百练OJ-反反复复
很奇怪,题目上明明说n是2到20,但是如果只给array开21,提交就会RE,22就可以AC。。。#include<iostream> #include<string> #include <array> #include<math.h> #include<algorithm> using namespace std; int ...
2018-04-01 20:23:00
728
原创 百练OJ-Eqs
#include<math.h> #include<iostream> #include<vector> #include<cstring> using namespace std; vector<int>ranges; //map<int,short> leftnums; short leftnums[25000001]; ...
2018-03-30 19:51:36
316
原创 百练OJ-( Til the Cows Come Home)dijksra最短路径
#include<iostream> #include<cstring> #define inf 999999 using namespace std; int T,N; int edges[1001][1001]; int dis[1001]; int fg[1001]; int main() { cin >>T>> N; memset(edg...
2018-03-30 19:49:49
294
原创 百练OJ-月度开销
#include<iostream> #include<cstring> using namespace std; bool check(int mid, int m, int*kaixiao,int n) { int sum = 0; int yue = 1; for (int i = 0; i < n; i++) { if (sum+ kaixiao[...
2018-03-30 19:42:00
660
原创 百练OJ-单词翻转
#include<iostream> #include<cstring> #include<string> #include<algorithm> using namespace std; int main() { string s; getline(cin,s); char ss[1000]; strcpy(ss, s.c_str()); ...
2018-03-30 19:40:19
550
原创 百练OJ-Prime Path
#include<queue> #include<iostream> #include<vector> #include<math.h> #include<cstring> using namespace std; vector<int>primes; void makeprimes() { primes.push_ba...
2018-03-29 16:21:19
327
原创 百练OJ-ISBN号码
#include<iostream> #include<math.h> #include<string> #include<vector> using namespace std; void replace_all(string & s, string const & t, string const & w) { strin...
2018-03-28 16:16:37
342
原创 百练OJ-Railway tickets
#include<iostream>//动态规划 using namespace std; #define INF 0x3f3f3f3f int main() { int L1, L2, L3, C1, C2, C3; //cin >> L1 >> L2 >> L3 >> C1 >> C2 >> C3; sc
2018-03-28 16:15:05
322
原创 百练OJ-回文素数
#include<iostream>//isprimes加上会运行的更快,但是线上OLE。。。不清楚原因 #include<vector> #include<string> #include<set> #include<cmath> using namespace std; bool isPrime(int num,vector<i...
2018-03-28 16:12:32
620
原创 百练OJ-肿瘤检测
#include "stdafx.h"#include<iostream>//超时的版本#include<math.h> #include<string> #include<vector> using namespace std; typedef pair<int, int> POINT; bool is_in_Vector(vector...
2018-03-26 17:49:08
503
原创 百练OJ题-素因子分解
#include<iostream> #include<math.h> #include<string> using namespace std; bool isPrime(int n) { for (int i = 2; i < n; i++) { if (n%i == 0) { return 0; } } return 1; }...
2018-03-26 16:30:27
478
转载 C++replace_all strip函数
// replace all occurance of t in s to w void replace_all(std::string & s, std::string const & t, std::string const & w) { string::size_type pos = s.find(t), t_size = t.size(), r_size ...
2018-03-26 16:11:49
2521
1
空空如也
hashing表如何遍历输出表中的数据呢??
2016-11-04
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅