现在的位置: 首页 > 综合 > 正文

poj 3117 World Cup

2013年02月28日 ⁄ 综合 ⁄ 共 465字 ⁄ 字号 评论关闭
//仔细分析题意之后,就会觉得这是一道好简单的题:赢球得3分,输球得0分,平局得1分!现在假设有3场球赛:
//如果没有输球的球队,则总的分数为9分,如果有一场是平局的情况下,则总的分数为:平局的2分加上赢球的3*2,总共为8分;
//如果有二场是平局的情况下,则总的分数为:平局的2*2加上赢球的3*1,总共为7分,按照这样的规律分析下去,结果就出来了! 
#include <iostream>
#include <string>
using namespace std;

struct Info
{
     string name;
     int scores;
}team[250];

int main()
{
    int i, t, n, sum, ans, tot;
    while (cin >> t >> n)
    {
          if (t == 0)  break;
          sum = 0;
          for (i = 0; i < t; i++)
          {
              cin >> team[i].name >> team[i].scores;
              sum += team[i].scores;
          }
          tot = n * 3;
          ans = tot - sum;
          cout << ans << endl;
    }
    
    system("pause");
}

抱歉!评论已关闭.