poj3117

我们只注意各队比分之和,认为一场比赛会如果战平则总和+2否则总和+3。

所以我们只要输出3 * n - sum就可以了。

View Code
#include <iostream>
#include
<cstdio>
#include
<cstdlib>
#include
<cstring>
using namespace std;

int main()
{
//freopen("D:\\t.txt", "r", stdin);
int n, t;
while (scanf("%d%d", &t, &n) != EOF && !(t == 0 && n == 0))
{
int sum = 0;
getchar();
for (int i = 0; i < t; i++)
{
string st;
int a;
cin
>> st;
scanf(
"%d", &a);
sum
+= a;
getchar();
}
printf(
"%d\n", 3 * n - sum);
}
return 0;
}
原文地址:https://www.cnblogs.com/rainydays/p/1966847.html