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

AOJ 0207 Block

方針 自分で処理しやすいようにマップ作っていって,始点の位置にある色と同じ色を始点と接している場所から塗りつぶしていく. コード typedef pair<int, int> P; const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int w, h, xs, ys, xg, yg, n; int m[128][1</int,>…

AOJ 0191 Baby Tree

方針 メモ化再帰. memo[i][j] := j番目の肥料を直前に与え,i回目の肥料を与える時の成長度の最大値 ソースコード double g[128][128]; double memo[128][128]; int n, m; double dfs(int c, int prev) { if(c == m) return 1.0; if(memo[c][prev] != -1) re…

AOJ 0154 Sum of Cards

方針 メモ化再帰. 主に下準備で面倒くさいコードになってしまいました. コード int memo[8][1024]; struct card { int value; // 値 int resid; // 残数 card(int a, int b) : value(a), resid(b) {} }; void input(int m, vector<card>& cards) { int a, b; for(i</card>…

AOJ 0089 The Shortest Path on A Rhombic Path

方針 再帰をしろという天からの声が聞こえた気がしたので,再帰を書いたのですがなぜか通らず. ということでfor文に直して解きました. dp[i][j] := i段目j個目まで選んだときの最大の値 半分より上の時と下の時で進む方向が変わるので注意です. コード int…

K2PC Easy

結果 下らないミスして3完でしたが, しなくても3完です. A - ハンバーガー(Hamburger) 方針 問題文通りにやれば通る コード int main() { int n; int a, b, c; cin >> a >> b >> c; cin >> n; int _a = n, _b = 2 * n, _c = 3 * n; cout << (_a - a <= 0 ? 0…

AOJ 0033 Ball

友人が解いていたので再び解いてみた. 方針 全探索しました.O(2^10)かな. #include <iostream> #include <vector> #include <algorithm> #include <cstdio> using namespace std; int ball[10]; bool dfs(int i, int prevLeft, int prevRight) { if(i == 10) return true; if(prevLeft < ball[i]) </cstdio></algorithm></vector></iostream>…

Mail.appでhotmailを送受信できるようにする

ちょっとだけ詰まったのでメモ 環境 Mac OS X 10.8 受信用メールサーバ pop3.live.com 送信用メールサーバ smtp.live.com 送信用メールサーバの設定の詳細 デフォルトポートを使用からカスタムポートを使用にする(ポートは587) 認証をパスワードにする. Appl…

AOJ 0180 Stellar Performance of the Debunkey Family

方針 最小全域木。 AOJ 0072 Carden Lantern - Allen' Memoと一緒です。 const int INF = 1 << 30; int V; int cost[100][100]; int mincost[100]; bool used[100]; int prim() { int res = 0; mincost[0] = 0; while(1) { int v = -1; for(int u = 0; u < V…

AOJ 0072 Carden Lantern

方針 最小全域木問題。 プリム法で解いています 蟻本と一緒です。 const int INF = 1 << 30; int cost[100][100]; int mincost[100]; bool used[100]; int V; int prim() { int res = 0; mincost[0] = 0; while(1) { int v = -1; for(int u = 0; u < V; u++)…