AOJ

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

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

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

AOJ 0057 The Number of Area

404 Not Found #include <cstdio> int main() { int n; while(~scanf("%d\n", &n)) printf("%d\n", (n * n + n + 2) / 2); return 0; } just implemented a formula that I found on the internet</cstdio>

AOJ 0074 Videotape

404 Not Found #include <cstdio> int main() { int l, m, n; while(~scanf("%d %d %d", &l, &m, &n), ~l && ~m && ~n){ long long total = l * 60LL * 60 + m * 60 + n, remaining = 120 * 60 - total; printf("%02lld:%02lld:%02lld\n", remaining / 60 / 60, rema</cstdio>…

AOJ 0071 Bombs Chain

404 Not Found #include <cstdio> #include <vector> #include <queue> using namespace std; typedef struct {int x, y;} p; char m[8][9]; inline bool valid(int n){return 0 <= n && n < 8;} inline void addqueue(queue<p>& q, int x, int y){ if(valid(x) && valid(y)) if(m[y][x</p></queue></vector></cstdio>…

AOJ 0085 Joseph's Potato

404 Not Found #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { int n, m; while(scanf("%d %d\n", &n, &m), n && m){ vector<int> v; for(int i = 1; i <= n; i++) v.push_back(i); vector<int>::iterator it = v.begin(); while(1 < v.size()){ fo</int></int></algorithm></vector></cstdio>…

AOJ 0085 Joseph's Potato

404 Not Found #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { int n, m; while(scanf("%d %d\n", &n, &m), n && m){ vector<int> v; for(int i = 1; i <= n; i++) v.push_back(i); vector<int>::iterator it = v.begin(); while(1 < v.size()){ fo</int></int></algorithm></vector></cstdio>…

AOJ 0056 Goldbach's Conjecture

404 Not Found #include <cstdio> int main() { int n; char prime[50001]; for(int i = 0; i <= 50000; i++) prime[i] = 1; prime[0] = 0; prime[1] = 0; for(int i = 2; i <= 50000; i++){ if(!prime[i]) continue; for(int j = i + i; j <= 50000; j += i) prime[</cstdio>…

AOJ 0044 Prime Number II

404 Not Found #include <cstdio> inline int isprime(int n){ for(int i = 2; i <= n / 2; i++){ if(!(n % i)) return 0; } return 1; } int main() { int n; while(~scanf("%d\n", &n)){ for(int i = n - 1; 0 <= i; i--){ if(isprime(i)){ printf("%d ", i); brea</cstdio>…

AOJ 0063 Palindrome

404 Not Found #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; int cnt = 0; while(cin>>s){ t = s; reverse(t.begin(), t.end()); cnt += s == t; } cout<</algorithm></string></iostream>

AOJ 0502 Dice

404 Not Found #include <iostream> #include <string> using namespace std; class Dice { public: int top, bottom, west, east, south, north; Dice(){ top = 1;bottom = 6; west = 4;east = 3; south = 2;north = 5; } void North(){ int tmp = top; top = south; south = </string></iostream>…

AOJ 0014 Integral

404 Not Found #include <cstdio> int main() { int d; while(~scanf("%d\n", &d)){ long long total = 0; for(int i = d; i < 600; i += d) total += (long long)i * i * d; printf("%lld\n", total); } return 0; }</cstdio>

AOJ 0019 Factorial

404 Not Found #include <cstdio> int main() { int n; scanf("%d\n", &n); long long m = n; while(--n) m *= n; printf("%lld\n", m); return 0; }</cstdio>

AOJ 0100 Sale Result

404 Not Found #include <cstdio> #include <vector> using namespace std; int main() { long long n; while(scanf("%Ld\n", &n), n){ vector<pair<long long, long long> > v; for(long long i = 0; i < n; i++){ long long p, q, r, f = 1; scanf("%Ld %Ld %Ld\n", &p, &q, &r); for(long long j = 0;</pair<long></vector></cstdio>…

AOJ 0500 Card Game

404 Not Found #include <cstdio> int main() { int n; while(scanf("%d\n", &n), n){ int scr_a = 0, scr_b = 0; for(int i = 0; i < n; i++){ int cur_scr_a, cur_scr_b; scanf("%d %d\n", &cur_scr_a, &cur_scr_b); if(cur_scr_a == cur_scr_b){ scr_a += cur_scr</cstdio>…