码迷,mamicode.com
首页 > 其他好文 > 详细

UVa 11917 - Do Your Own Homework

时间:2015-06-29 00:34:59      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

题目: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!