2011-10-25から1日間の記事一覧

AOJ - Problem 0124 : League Match Score Sheet

問題文 各チーム毎に勝ち点をそれぞれ勝(3点)、負(0点)、引分(1点)で計算し、勝点の高いチームから順にチーム名と勝点を出力します。 勝点が同じときは入力の順に出力することに気をつけてソートしましょう。 #include <iostream> #include <vector> #include <map> #include <string> #incl</string></map></vector></iostream>…

AOJ - Problem 0128 : Abacus

AOJ

問題文 入力した数値に対応するようなそろばんの配置を出力します。 あらかじめ数字(0-9)ごとの文字列のテーブルをつくっておいて各桁ごとに数字を見ていけばよい思います。 #include <iostream> #include <string> using namespace std; string f[10] = { "* = ****", "* =* *</string></iostream>…

AOJ - Problem 0151 : Grid

AOJ

問題文 縦横斜めに連続して1が並ぶ列のうち列の長さが最大のものを出力します。全探索するだけでよいようです。 #include <iostream> #include <string> #include <algorithm> using namespace std; int dx[] = {1,0,1,-1}; int dy[] = {0,1,1,1}; int main(){ int n; while( cin >> n , n</algorithm></string></iostream>…

AOJ - Problem 0161 : Sport Meet

問題文 4種目の合計タイムの合計タイムが1番小さいチームと2番目に小さいチームと2番目に大きいチームのチーム番号を出力します。 ソートするとよいと思います。 #include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; typedef pair<int,int> P; int main(){</int,int></algorithm></map></vector></iostream>…

AOJ - Problem 0116 : Area of Polygon

問題文 円に内接する2つの多角形の面積の大きさを比較する問題です。 三角形の面積は(半径)*(半径)*sinθ÷2で計算できます。 面積の大きさの比較だけなので半径を1として(÷2)を省略しても問題ないでしょう。 #include <iostream> #include <vector> #include <cmath> using namespace s</cmath></vector></iostream>…