2012-09-01から1ヶ月間の記事一覧

AOJ 0503

じりきで解けなかった。 漸化式作るのむずかしすぎ(頭悪い) #include <cstdio> #include <algorithm> using namespace std; const int MAX_N = 15; int N, M; int cup[MAX_N]; int main(){ while(scanf("%d %d",&N,&M)&&N!=0){ for(int i=0; i<3; i++){ int K; scanf("%d", &K);</algorithm></cstdio>…

AOJ 2005 Water Pipe Construction

問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2005 #include <cstdio> #include <algorithm> using namespace std; const int INF = 1<<29; const int MAX_N = 100; int N,M,S,G0,G1; int cost[MAX_N][MAX_N]; int min_cost[MAX_N][MAX_N]; int wf(){ for(in</algorithm></cstdio>…

AOJ 0527 Setting Go Stones

AOJ

地道にシミュレーションする。 時間ギリギリだった #include <cstdio> #include <algorithm> using namespace std; int main(){ int N; while(scanf("%d",&N) && N!=0){ int stone[N]; for(int i=1; i<=N; i++){ int t; scanf("%d", &t); if(i%2==1) stone[i-1] = t; else{ for(</algorithm></cstdio>…

AOJ 0555

AOJ

yarudake #include <cstdio> #include <cstring> using namespace std; int main(){ char str[11], c; int N, len; char ring[11]; scanf("%s", str); scanf("%d", &N); int ans=0; for(int i =0; i</cstring></cstdio>

POJ 2707 Copier Reduction

POJ

問題 http://poj.org/problem?id=2707解法 ほとんどやるだけ 両方とも横長か縦長に揃えて考えるといい。 あとは場合分けを気をつける #include <cstdio> #include <algorithm> using namespace std; int x1, y1, x2, y2; void swap(int *a, int *b){ int t; t = *a; *a = *b; *b</algorithm></cstdio>…

AOJ 0228 Seven Segments

明日テスト…… 簡単なやつをやったテーブルを作るだけの簡単なお仕事 #include <cstdio> using namespace std; const int d[11][7]={ {0,1,1,1,1,1,1}, {0,0,0,0,1,1,0}, {1,0,1,1,0,1,1}, {1,0,0,1,1,1,1}, {1,1,0,0,1,1,0}, {1,1,0,1,1,0,1}, {1,1,1,1,1,0,1}, {0,1</cstdio>…

AOJ 0213 Subdivide the Land

問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0213解法 全探索すればいいらしい。実装キツい。 #include <cstdio> #include <algorithm> using namespace std; typedef pair<int,int> P; const int MAX_N = 15; const int MAX_XY = 10; int N, X, Y; int memo[MAX_N];</int,int></algorithm></cstdio>…

AOJ 0211 Jogging

PCK本選に向けての練習 1日1ACを目標にしている。問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0211解法 d[i], v[i] のときの周回数を m[i] 回とし、周回時間 d[i]/v[i]*m[i]=T 時間とする(Tは一定の値) このとき (m[i]=) T*(v[i]/d[i]) …

POJ 1948 Triangular Pastures

http://poj.org/problem?id=1948自力で解けなかった。 なんか、頭いい方法でDPするらしい。 こんなループのまわし方はどうやったら思いつくのだろうか。 #include <cstdio> #include <math.h> #include <algorithm> using namespace std; const int M_N = 40; const int M_L = 40; int N</algorithm></math.h></cstdio>…

POJ 1936 All in All

PCK参加しました。 bitDP気づいたけど実装力なさすぎでバグりまくったのが悔しい 本選参加できるかどうか微妙(地域枠) 今はコード手元にないから今度のせる(追記) コードはどっかいったPOJ 1936部分文字列かどうか判定する問題 再帰書くだけでよい solve(p, …

SRM555

コンパイルエラーに悩んでいたらただ using namespace std; を書き忘れただけっていう。 早解きの練習が必要。 712 -> 715 (+3) #include <cstdio> #include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; class XorBoardDivTwo{ public: int theMax(vector <string></string></string></vector></algorithm></iostream></cstdio>…

SRM554

スーパーコンはレベル高すぎで、ついていけなかったです…。SRM554に参加しました 解法の勘違いしてEasyしか解けなくて人権ない #include <cstdio> #include <algorithm> using namespace std; class TheBrickTowerEasyDivTwo{ public: int find(int rC, int rH, int bC, int bH)</algorithm></cstdio>…