2010-11-19から1日間の記事一覧

0105-Book Index

AOJ

http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=0105入力データーを構造体に入れてソート typedef struct a { char b[50]; int p; } a; a s[255]; int n, i, k; int cmp(const a *s, const a *t) { k = strcmp(s->b, t->b); if (k) re…

0104-Magic Tile

AOJ

http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=0104&lang=jp すでに通ったマスを記録しておく。 同じマスを二度通った場合ループしていることが分かる。 #include <cstdio> char m[102][102];//マップ int main(){ while(1){ int h,w,x,y; sc</cstdio>…

0103-Baseball Simulation

AOJ

http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=0103 塁に居る人は必ず連続していることを利用する。 #include <iostream> #include <string> using namespace std; main() { int n,p,r,a; string t; cin >> n; for(int i=0;i<n;i++){ a=0;r=0;p=0; while(a<3){ std::cin >> t; if(t=="HIT"){ r++; if</n;i++){></string></iostream>…