Algorithm

AOJ 0191 Baby Tree

404 Not Found やっとまともにDP解けたー!!!!!(嬉) #include <cstdio> #include <algorithm> using namespace std; int main() { int n, m; while(scanf("%d %d\n", &n, &m), n || m){ long double g[n][n]; /* dp[a][b]は、a回目にbの肥料を与えた時のaまでの成長率の最大値 */</algorithm></cstdio>…

AOJ 2216 Summer of KMC

404 Not Found #include <cstdio> int main() { int A, B; while(scanf("%d %d\n", &A, &B), A || B){ int hyak = 0, gohyak = 0, sen = 0; int x = B - A; if(1000 <= x){ sen = x / 1000; x %= 1000; } if(500 <= x){ gohyak = x / 500; x %= 500; } if(100 <= x){</cstdio>…

Codeforces Beta Round #54 (Div. 2)

A. Chat room #include <iostream> #include <string> using namespace std; int main() { string s, t("hello"); cin>>s; int cnt = 0; for(int i = 0; i < s.size(); i++){ if(cnt >= t.size()) break; if(s[i] == t[cnt]){ cnt++; } } cout<<(cnt >= t.size() ? "YES" : "NO</string></iostream>…

TopCoder SRM 496 DIV2

Rating: 654→892(灰) 前が酷かったので上がってもまだ灰色コーダーだけれども、大分一気に上がった。Total: 698.3 points 250: AnagramFree 239.97 points #include <map> #include <string> #include <vector> using namespace std; class AnagramFree { public: int getMaximumS</vector></string></map>…

JOI過去問未solved一覧

×:実装方法分からず ?:実装したけどアルゴリズム分からず △:実装したけどバグとれず ○:Solved 無印:ノンタッチ 第5回 予選 ×AIZU ONLINE JUDGE ×AIZU ONLINE JUDGE 本選 ×AIZU ONLINE JUDGE ×AIZU ONLINE JUDGE 第6回 本選 △AIZU ONLINE JUDGE △AIZU O…

日本情報オリンピック 第8回本選

JOI 2008-2009 本選 問題・データ 1. IOIOI 404 Not Found #include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n; while(cin>>n, n){ long long m; string s; cin>>m>>s; n = 2 * n + 1; vector<long long> v; int len = 0; bool is_seq = 0; </long></vector></string></iostream>…

日本情報オリンピック 第7回本選

JOI 2007-2008 本選 問題・データ 1. 碁石ならべ 何故かWAする。たしかにテストケースに対する答え見ると違う。なんでだろう。問題を理解できてないのかなあ…見た通り実装した筈なんだが… 2. 共通部分文字列 Longest Common Subsequenceではない。Longest Co…

日本情報オリンピック 第6回本選

JOI 2006-2007 本選 問題・データ 1. 最大の和 404 Not Found #include <cstdio> #include <vector> #include <climits> using namespace std; int main(){ int n, k; while(scanf("%d %d\n", &n, &k), n || k){ vector<int> v(n); for(int i = 0; i < n; i++) scanf("%d\n", &v[i]); int S</int></climits></vector></cstdio>…

日本情報オリンピック 第5回本選

JOI 2006 本選 問題・データ 1. Questionnaire 404 Not Found #include <cstdio> #include <map> #include <set> #include <vector> using namespace std; int main() { int n, m; while(scanf("%d %d\n", &n, &m), n || m){ map<int, int> ma; for(int i = 0; i < n; i++){ for(int j = 0, x; j </int,></vector></set></map></cstdio>…

POJ 1005 I Think I Need a Houseboat

1005 -- I Think I Need a Houseboat #include <cstdio> #include <cmath> int main() { int N; const double pi = 3.1415; scanf("%d\n", &N); for(int i = 0; i < N; i++){ double X, Y; scanf("%lf %lf\n", &X, &Y); double a = sqrt(X*X + Y*Y); for(int j = 0; ; j++){</cmath></cstdio>…

JOI予選過去問 解けなかった問題、まだ解いていない問題

要デバッグ 第9回 6. 方向音痴のトナカイ AOJ 0548 Reindeer with no sense of direction 第8回 4. 薄氷渡り AOJ 0535 Crossing Black Ice 第5回模試1 3. Two Number Cards 第5回模試2 1. Tunnel 解説を読んでアルゴリズムを理解しないといけない 第8回 5. …

情報オリンピック 第5回模擬試験1, 2

模擬試験の問題はJOIにはありません。ので、手元で一応確認したものの間違ってる可能性も。 オーダーとか何それって感じ。 情報オリンピック 第5回模擬試験1 JOI 2006 模擬試験1 問題・データ 1. Triangle Types #include <cstdio> #include <vector> #include <algorithm> using names</algorithm></vector></cstdio>…

JOI予選過去問解けなかった物(2010/12/16 12:00時点)

(Total Progress: 4 / 10) 第9回 6. 方向音痴のトナカイ AOJ 0548 Reindeer with no sense of direction 404 Not Foundどこから手をつけていいかすら分からない。 実際ヒント見るとそんなに難しくはない。けど何故かTLE→Runtime Error。えーそんなー。ところ…

情報オリンピック 第5回予選問題

JOI 2006 予選 問題・データ 1. AOJ 0500 Card Game 404 Not Found 時間があったらまた解く。 2. AOJ 0501 Data Conversion 404 Not Found AOJ 0501 Data Conversion - ペリャウドのプログラミングとか 時間があったらまた解く。 3. AOJ 0502 Dice 404 Not F…

情報オリンピック 第7回予選問題

JOI 2007-2008 予選 問題・データ 1. おつり AOJ 0521 Change AIZU ONLINE JUDGE #include <cstdio> int count(int x){ int coins = 0; while(x >= 500) coins++, x -= 500; while(x >= 100) coins++, x -= 100; while(x >= 50) coins++, x -= 50; while(x >= 10) co</cstdio>…

情報オリンピック 第8回予選問題

JOI 2008-2009 予選 問題・データ 1. タイムカード AOJ 0532 Time Card 404 Not Found #include <cstdio> class Time { public: int h, m, s; void read(){ scanf("%d %d %d\n", &h, &m, &s); return; } long long totalsec(){ return h*60*60 + m*60 + s; } static </cstdio>…

情報オリンピック 第6回予選問題

JOI 2006-2007 予選 問題・データ 1. 得点 AOJ 0510 Score 404 Not Found #include <cstdio> #include <algorithm> using namespace std; int main() { int A = 0, B = 0; for(int i = 0, t; i < 4; i++) scanf("%d\n", &t), A += t; for(int i = 0, t; i < 4; i++) scanf("%d\n</algorithm></cstdio>…

情報オリンピック 第9回予選問題

JOI対策の一環で解いた。AOJ in JOI,PCK 回別リスト - 簡潔なQ ありがてえありがてえqnighyさんありがとうございます。 AOJ 0543 Receipt 404 Not Found #include <cstdio> int main() { int total; while(scanf("%d\n", &total), total){ int others = 0; for(int i</cstdio>…

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>…

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>…

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>…

TopCoder SRM 486 DIV 2

197.12点。Rating: 598 -> 724 灰色なりにやっと初期の水準を回復してきた。次回でコケなければ緑に戻れるか? 250 Text Message 基本的に一発で書いて一発でテスト通して一発で提出したつもりだったのだが、案外と書くのに時間がかかってしまったせいで、200…