2010-08-15から1日間の記事一覧

SRM 479 DIV 2 250の過去問

数回TopCoderできなかったのでせめて過去問でも解く。 #include <vector> using namespace std; class TheAirTripDivTwo { public: int find(vector <int> flights, int fuel) { for(int i = 0; i < flights.size(); i++){ fuel -= flights[i]; if(fuel == 0) return i + </int></vector>…

AOJ 0048 Class

404 Not Found #include <cstdio> int main() { float n; int m; const char *rank[] = {"light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"}; while(~scanf("%f\n", &n)){ if(n <= 48</cstdio>…

AOJ 0047 Cup Game

404 Not Found #include <cstdio> #define swp(a,b) a ^= b,b ^= a,a ^= b; int main() { int cups[3] = {1, 0, 0}; unsigned char a, b; while(~scanf("%c,%c\n", &a, &b)) swp(cups[a - 'A'], cups[b - 'A']); printf("%c\n", cups[0] * 'A' + cups[1] * 'B' + cup</cstdio>…

AOJ 0061 Rank Checker

404 Not Found #include <map> #include <vector> #include <cstdio> using namespace std; int main(){ int n, m; map<int, vector<int> > l; vector<vector<int> > v; while(~scanf("%d,%d\n", &n, &m)){ if(!n && !m) break; l[m].push_back(n); } for(map<int, vector<int> >::reverse_iterator rit = l.rbegin(); rit …</int,></vector<int></int,></cstdio></vector></map>

K&RとCプログラマのためのアルゴリズムとデータ構造、読了

旅行に行ってきた。その移動中の待ち時間等で2冊ほど読み終えた。 K&R プログラミング言語C 第2版 ANSI規格準拠作者: B.W.カーニハン,D.M.リッチー,石田晴久出版社/メーカー: 共立出版発売日: 1989/06/15メディア: 単行本購入: 28人 クリック: 721回この商品…

AOJ 0075 BMI

404 Not Found #include <cstdio> int main() { int l; double m, n; while(~scanf("%d,%lf,%lf\n", &l, &m, &n)) if(25.0 <= m/(n*n)) printf("%d\n", l); return 0; }</cstdio>

AOJ 0020 Capitalize

404 Not Found #include <cstdio> int main() { char n; while(~(n = getchar())) putchar('a' <= n && n <= 'z' ? n - 'a' + 'A' : n); return 0; } あまり気合の入らないショートコーディング main(n){while(n=getchar(),~n)putchar(96</cstdio>