2014年4月16日水曜日

会津大学オンラインジャッジ 問138

Track and Field Competition

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0138
スポーツのタイム記録から上位者を選ぶ問題。


#include<stdio.h>
#include<map>

std::map<double,int> third;
std::map<double,int>::iterator it;
void calc(){
    std::map<double,int> tops;
    int no;
    double time;
    for(int i=0;i<8;i++){
        scanf("%d %lf",&no,&time);
        tops[time]=no;
    }
    it=tops.begin();
    for(int i=0;i<2;i++){
        printf("%d %.2lf\n",(*it).second,(*it).first);
        it++;
    }
    third[(*it).first]=(*it).second;
    it++;
    third[(*it).first]=(*it).second;
}
int main(){
    calc();
    calc();
    calc();
    it=third.begin();
    for(int i=0;i<2;i++){
        printf("%d %.2lf\n",(*it).second,(*it).first);
        it++;
    }
}

0 件のコメント:

コメントを投稿