algorithm
IpursueI
这个作者很懒,什么都没留下…
展开
-
九度oj-1365:贝多芬第九交响曲
#include#include#includeusing namespace std;typedef struct step{ int x; int y; int cost;}step;int mark[101][101];int next[][2] = { -2,1, -1,2, 1,2, 2,1, -2,-1, -1,-2, 1,-2, 2,-1原创 2014-03-13 12:48:11 · 900 阅读 · 0 评论 -
九度oj-1341:艾薇儿的演唱会
#include#includeint map[101][101];int mark[101];int dis[101];int main(){ int n,m,a,b,i,j,t,ta,tb,min,idx; while(scanf("%d", &n) != EOF) { scanf("%d", &m); scanf("%d%d", &a, &b); for原创 2014-03-13 10:22:37 · 535 阅读 · 0 评论 -
LeetCode 332 : Reconstruct Itinerary
Reconstruct Itinerary该题是常规的图搜索相关的题目,使用dfs便可以解决,可惜自己还是折腾了好久。 先贴上我原先的代码:#include <iostream>#include <vector>#include <set>#include <string>#include <map>#include <unordered_map>using namespace std原创 2016-03-24 11:14:31 · 641 阅读 · 0 评论 -
部分和问题
从给定整数a1,a2,a3...ana_1, a_2,a_3...a_n,判断是否可以从中选出若干数,使他们的和恰好为k。#include <cstdio>#include <cstdlib>using namespace std;const int Maxn = 21;int a[Maxn];int n,k;bool dfs(int k, int i){ if(i==n){原创 2016-04-07 13:30:35 · 400 阅读 · 0 评论 -
hihoCoder:403 Forbidden
403 Forbidden这道题写起来真是一把辛酸泪啊。各种问题。。。 下面贴出修改后的代码#include <iostream>#include <cstdlib>#include <cstdio>using namespace std;int N,M;char per[20];char ipf[100];class TrieNode {public: TrieNode(){原创 2016-04-12 15:12:01 · 616 阅读 · 0 评论 -
LeetCode: Implement Trie (Prefix Tree)
Implement Trie (Prefix Tree)#include <iostream>using namespace std;class TrieNode {public: // Initialize your data structure here. TrieNode() { for(int i=0; i<26; i++){ ne原创 2016-04-11 12:27:35 · 415 阅读 · 0 评论