题目:Soha有很多作业要写,而Sparrow会帮助他,不过每个作业要一定的时间完成,
现在给你需要交的作业和时间期限,问能否完成,在期限后5天内完成属于交晚。
分析:简单题,字符串。字符串相同的比较天数即可。
说明:╮(╯▽╰)╭。
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
char work[505][22],test[22];
int days[505],day;
int main()
{
int T,n;
while (~scanf("%d",&T))
for (int t = 1; t <= T; ++ t) {
scanf("%d",&n);
for (int i = 0; i < n; ++ i)
scanf("%s%d",work[i],&days[i]);
scanf("%d%s",&day,test);
printf("Case %d: ",t);
int get = 0;
for (int i = 0; i < n; ++ i)
if (!strcmp(test, work[i])) {
if (days[i] <= day+5) {
if (days[i] <= day) puts("Yesss");
else puts("Late");
get = 1;
}
}
if (!get) puts("Do your own homework!");
}
return 0;
}
UVa 11917 - Do Your Own Homework
原文:http://blog.csdn.net/mobius_strip/article/details/46675563