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

二日間のAnarchy Golfの成果

id:kyuridenamidaが昨日から遊びにきて、今日の夜に帰っていった。他にやる事もないので結局プログラミング合宿風になった。 延々とLinux CafeでCode Golfをしたりして遊んだ。 ちなみに合宿中は僕が今壊れてないノートPCを持っていないのもあってperyaudena…

AOJ 0013 Switching Railroad Cars

※AOJはショートコーディングをする場ではありません 短縮前 #include <cstdio> #include <vector> int main(){ int n; std::vector<int> v; while(scanf("%d\n", &n)+1){ if(n){ v.push_back(n); }else{ printf("%d\n", v.back()); v.pop_back(); } } return 0; } 短縮後 #include <cstdio></cstdio></int></vector></cstdio>…

AOJ 0011 Drawing Lots

今日はid:kyuridenamidaと延々とリナカフェでcode golfをしたり秋葉原をほっつき歩いたりした。 まだこれからコードを書く。東京タワーとか見に行っても楽しくないしいっその事コーディング合宿って事でもいいんじゃないかって話になってる。初期状態のvを1…

AOJ 1000 A + B Problem

気休め、のはずなのにアホみたいなミスして不要なTLEをしてしまった。 #include <cstdio> int main(){ int a, b; while(scanf("%d %d\n", &a, &b)+1) printf("%d\n", a + b); return 0; }</cstdio>

AOJ 0008 Sum of 4 Integers

#include <cstdio> #include <vector> #include <map> using namespace std; int main(){ int n; vector<int> v(4); map<vector<int>,bool> m; while(scanf("%d\n", &n)+1){ m.clear(); for(v[0] = 0; v[0] < 10; v[0]++) for(v[1] = 0; v[1] < 10; v[1]++) for(v[2] = 0; v[2] < 10; v[2]++) for(v</vector<int></int></map></vector></cstdio>…

AOJ 0007 Dept Hell

#include <cstdio> int main(){ int t,n; scanf("%d\n",&n); for(t=100000;n;n--){ t+=t/20; if(t%1000)t+=1000-t%1000; } printf("%d\n",t); } なんかひどい</cstdio>

AOJ 0006 Reverse Sequence

1回目は3'15"で解けたんだけども、Compile Error喰らって、その喰らった理由ってのも酷くてgets使ってんじゃねーぞ的な警告自体がエラーとされてて、仕方ないからfgetsにしたら今度はWA: Presentation Errorって出て、最後にputs("")っていう格好悪い事をし…

AOJ 0005 GCD and LCM

6'43"。まあもうちょっと早く解けてもいいかなあ。イチイチgcdの求め方をぐぐっているのもいただけない。 #include <cstdio> int main(){ long long unsigned int a, b, gcd, lcm; while(scanf("%llu %llu\n", &a, &b)+1){ long long unsigned int m, n, o; m = a; n</cstdio>…

AOJ 0004 Simultaneous Equation

だいたい11'ぐらい。手元でチマチマ方程式を解いただけ。 #include <cstdio> int main(){ int a, b, c, d, e, f; double x, y; while(scanf("%d %d %d %d %d %d\n", &a, &b, &c, &d, &e, &f) != EOF){ y = (double)(a * f - c * d) / (double)(a * e - b * d); x = (</cstdio>…

AOJ 0003 Is it a Right Triangle?

lvalue required as left operand of assignment、とかいう意味不明なエラーに悩ませられて結局==を=と書いてただけのポカミスだったと気付いて、結局8'39"だった。 #include <cstdio> int main(){ int N; scanf("%d", &N); for(int i = 0; i < N; i++){ int a, b, c</cstdio>…

AOJ 0002 Digit Number

1回目解答まで3'37"、しかし1回目はWrong Answerされた。 sprintfをsscanfって書いた。 解法で一瞬でも悩んじゃいけませんね。悩んだ時間で問題の単純かどうかとかはふっ飛ぶぐらいの時間が失なわれる。 #include <cstdio> int main(){ int a, b; char hoge[256]; wh</cstdio>…

AOJ 0001 List of Top 3 Hills

問題を開いてから書き終えるまで3'08"(手元のストップウォッチより)。 #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main(){ vector<int> m(10); for(int i = 0; i < 10; i++) scanf("%d\n", &m[i]); sort(m.begin(), m.end()); for(int i = 0; i < 3</int></algorithm></vector></cstdio>…

AOJ 0000 QQ

#include <cstdio> int main(){ for(int i = 1; i < 10; i++) for(int j = 1; j < 10; j++) printf("%dx%d=%d\n", i, j, i*j); return 0; } 芸はない。</cstdio>

TopCoder SRM 477

peryaudo(0)→●peryaudo(1031) 初参加にして緑コーダーになった。しかし、そもそも500点問題は最後まで正答できず終いで送信してSystem Testで落とされたし、1000点問題は見る余裕もなかった。初回からいいスコア出した故にいい感じのレートになっているらし…

PKU 1008 Maya Calendar

#include <cstdio> #include <cstring> int main(){ const char *haabmonths[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}; char haabmon[7]; int haabday, </cstring></cstdio>…

今日の英単語 "Cartesian coordinate system"

Cartesian coordinate system 意味:直交座標系/デカルト座標系

POJ 2027 No Brainer (82 bytes)

main(x,y){for(gets(&x);scanf("%d%d",&x,&y)+1;)puts(x

PKU 1007 DNA Sorting

#include <vector> #include <string> #include <iostream> #include <algorithm> using namespace std; class dna { public: string seq; int unsortedness; int getuns(){ unsortedness = 0; for(int i = 0, l = seq.size() - 1; i < l; i++){ for(int j = i + 1, m = l + 1; j < m; j++){ if(se</algorithm></iostream></string></vector>…

PKU 1003 Hangover

#include <iostream> using namespace std; int main(){ while(1){ double n; cin>>n; if(n == 0) break; for(int i = 1; ; i++){ n -= (double)1 / (double)(i + 1); if(n <= 0){ cout<</iostream>

.lnkファイルのファイルフォーマット

何かとCVE-2010-2568やらStuxnetやらで話題になっているlnkファイルのファイルフォーマット。 The_Windows_Shortcut_File_Format.pdfお好きな方はどうぞ。

AOJ 0127 Pocket Pager Input

#include <iostream> #include <cstdlib> using namespace std; int main(){ const char *table[] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "}; string s; while(cin >> s){ int row = 0, col = 0, na = 0; string t; if(s.size() % 2){ na = 1; }else{ for(int </cstdlib></iostream>…

EPOCH@まつやまの予選解答分全部提出しました

id:kyuridenamida君ともにおつかれさまでした。いざ提出し終えてみると結構不安になったりもするんですが、2人ともに結構な自信作なのでどうか通過してほしい所です。大連を目指そう!

EPOCH@まつやまに参加します

愛媛大学工学部情報工学科プログラミングコンテストid:kyuridenamidaとEPOCH@まつやまに参加する事になりました。 今必死で予選の解答案を2人で練ってます。本選に進めるように頑張ります。2人ともコーディング力は結構十分だなって感触がここまでの話し合…

Mac OS Xで、Ctrl + Scrollによる画面の拡大機能を切る

OSX

ゲームしてると邪魔な時がある。 システム環境設定→マウス→キーとスクロールホイールの併用で拡大縮小のチェックをはずす

PKU 1026(途中)

またもやTime Limit Exceeded。 #include <cstdio> using namespace std; int main(){ char *src, *dst; int i, j, k, *key, keylen; scanf("%u\n", &keylen); key = new int[keylen]; for(i = 0; i < keylen; i++){ scanf("%u[ \n]", &key[i]); key[i]--; } src = n</cstdio>…

PKU 1026(途中)

Time Limit Exceededされたコード。 #include <iostream> #include <vector> #include <string> using namespace std; int main(){ vector<int> key; int i, j, keylen, tmp; cin>>keylen; for(i = 0; i < keylen; i++){ cin>>tmp; tmp--; key.push_back(tmp); } while(1){ tmp = 0; vector<char> </char></int></string></vector></iostream>…

PKU 1028

#include <stack> #include <string> #include <iostream> using namespace std; int main(){ string s, c ("http://www.acm.org/"); stack<string> f,b; while(1){ cin>>s; if(s == "QUIT") break; if(s == "BACK"){ if(b.empty()){ cout<<"Ignored\n"; continue; } f.push(c); c = b.top(); </string></iostream></string></stack>…

eDonkey/eMuleのプトロコル

P2P

The eMule Protocol Specification国内ではあまり聞かないだけに、日本語の資料も少ない。まあ英語が読めるようになればいいんだけれども。

Mac OS X版のSteamのHalf-Life 2の設定ファイルの場所

/Users/ユーザー名/Library/Application Support/Steam/SteamApps/ユーザー名/half-life 2/hl2/cfg/config.cfg

1学期終了した

一応これから夏休みという事なので、それなりにコードを書いたりとかしていきたいと思います。