2010-11-01から1ヶ月間の記事一覧

AOJ 0117 A Reward for a Carpenter

404 Not Found #include <cstdio> #include <vector> #include <queue> #include <climits> using namespace std; class E { public: int to, cost; E(int to, int cost){ this->to = to; this->cost = cost; } }; class P { public: int cost, node; P(int cost, int node){ this->cost = co</climits></queue></vector></cstdio>…

AOJ 0526 Boat Travel

404 Not Found #include <cstdio> #include <vector> #include <queue> #include <climits> using namespace std; class E { public: int to, cost; E(int to, int cost){this->to = to;this->cost = cost;} }; class Pr { public: int cost, edge; Pr(int cost, int edge){this->cost = cost</climits></queue></vector></cstdio>…

AOJ 0021 Parallelism

404 Not Found #include <cstdio> int main() { int n; scanf("%d\n", &n); for(int i = 0; i < n; i++){ double x1, y1, x2, y2, x3, y3, x4, y4; scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4); puts(((y1 - y2) / (x1 - x</cstdio>…

Dijkstraとか

一応アリ本で理解できたつもりだけど、はやく自分で実装できるようにならんと。読む ダイクストラ法(最短経路問題) 解く 404 Not Found 404 Not Found

AOJ 0515 School Road

404 Not Found #include <cstdio> #include <vector> using namespace std; int a, b; vector<vector<char> > v; int dfs(int x, int y){ int _x = x + 1, _y = y + 1, m = 0; if(_x < a && y < b){ if(v[_x][y] == 0) m += dfs(_x, y); } if(x < a && _y < b){ if(v[x][_y] == 0) m += df</vector<char></vector></cstdio>…

PKU 3253 Fence Repair

3253 -- Fence Repairなんか理解に少し時間を要したけど簡単な事だった。 要求された中で最も短い板2つを足して、コストに加算 それらの長さを足して1枚の板とする その1枚の長い板と、その他の板の中から、また再び最も短い板2つを足して…(以下続く) なんだ…

PKU 2431 Expedition

2431 -- Expedition #include <cstdio> #include <vector> #include <queue> #include <algorithm> using namespace std; int main() { int N; vector<pair<int, int> > v; scanf("%d\n", &N); for(int i = 0; i < N; i++){ int x, y; scanf("%d %d\n", &x, &y); v.push_back(make_pair(x, y)); } int L, P; sc</pair<int,></algorithm></queue></vector></cstdio>…

PKU 3069 Saruman's Army

3069 -- Saruman's Army情報オリンピックだって近いのに僕はこんな程度で大丈夫なんだろうか。 いや、全然大丈夫じゃないんだが。あと半月程度でどこまで伸びられるかが勝負だけれどもそんなに急に伸びる物とも思えんしなぁ… #include <cstdio> #include <vector> #include <algorithm> </algorithm></vector></cstdio>…

Ubuntu 10.04LTSでOSXのpbcopyみたいにTerminalからコマンドでクリップボードに物をコピー

xselを使う。 sudo apt-get install xsel あとは ls -la | xsel -i -b みたいな感じで。

ThinkPad X60s下のUbuntu 10.04 LTSで指紋認証を使う

なんか色々ところころ変わっているらしく若干混乱した。以下おおまかな流れ。 ThinkFingerのインストール % sudo apt-get install thinkfinger-tools libpam-thinkfinger 指紋の作成とテスト 3回指をスワイプしろと言われるので、言われた通りにする。 % sud…

PKU 3617 Best Cow Line

3617 -- Best Cow Line #include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ int N; cin>>N; string s; for(int i = 0; i < N; i++){ char c; cin>>c;s += c; } string t, u; while(!s.empty()){ u = s; reverse(u.begin(), u.end()); if(u > s</algorithm></string></iostream>…

PKU 2386 Lake Counting

2386 -- Lake Countingアリ本もう一冊手に入れたので読み進めていく事にした。 #include <iostream> #include <vector> #include <string> using namespace std; bool inline validate(int x, int y, vector<string>& v){ return (0 <= x) && (x < v.size()) && (0 <= y) && (y < v[0].size());</string></string></vector></iostream>…

PKU 1051 P,MTHBGWB

1051 -- P,MTHBGWBモールス信号。 #include <iostream> #include <string> #include <map> #include <algorithm> using namespace std; inline void maketable(map<char, string>& enc, map<string, char>& dec){ const char *abc[] = { ".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-", ".-..","--","</string,></char,></algorithm></map></string></iostream>…

PKU 1068 Parencodings

1068 -- Parencodings #include <cstdio> #include <string> using namespace std; int main() { int t; scanf("%d\n", &t); for(int i = 0; i < t; i++){ int n; scanf("%d\n", &n); string s; for(int j = 0,lm = 0, m; j < n; j++){ scanf("%d", &m); s += string(m - lm,</string></cstdio>…