解题思路:
枚举每一天,算出在校学习和在家学习的总时间的最大值。
C++ 代码:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int maxv = -1, p;
for (int i = 1; i <= 7; i++)
{
int a, b;
cin >> a >> b;
if (a + b > maxv)
{
maxv = a + b;
p = i;
}
}
if (maxv > 8) printf("%d\n", p);
else puts("0");
return 0;
} 
京公网安备 11010502036488号