ZOJ 3220 Killing Streak(简单模拟)

首先按照击杀时间排个序再照着题目模拟就可以了.

#include <iostream>
#include <cstdio>
#include <memory.h>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
struct killing
{
	char p1[30],p2[30];
	int tim;
	bool operator<(const killing &rhs)const{
		return tim<rhs.tim;
	}
}ks[101];
struct hero{
	int lKT,acc,kwd;
};

map<string,hero>stds;
char buf[102];
int main(){
	int t;
	scanf("%d\n",&t);
	while (t--){
		stds.clear();
		int i=0;
		memset(ks,0,sizeof(ks));
		while (gets(buf)&&strcmp(buf,"#")){
			int m=0,s=0,tim=0;
			sscanf(buf,"%d:%d %s kills %s",&m,&s,ks[i].p1,ks[i].p2);
			tim=m*60+s;
			ks[i++].tim=m*60+s;
		}
		
		sort(ks,ks+i);
		for (int j=0;j<i;++j){
			hero &h1=stds[ks[j].p1],&h2=stds[ks[j].p2];
			char *p1=ks[j].p1;
			int tim=ks[j].tim;
			if(tim-h1.lKT<=14){
				h1.acc++;
			}else{
				h1.acc=1;
			}
			h1.lKT=tim;
			h1.kwd++;
			h2.kwd=0;
			if(j==0){
				printf("%s just drew First Blood!\n",p1);
			}
			if(h1.kwd==3){
				printf("%s has a Killing Spree!\n",p1);
			}else if(h1.kwd==4){
				printf("%s is Dominating!\n",p1);
			}else if(h1.kwd==5){
				printf("%s has a Mega Kill!\n",p1);
			}else if(h1.kwd==6){
				printf("%s is Unstoppable!\n",p1);
			}else if(h1.kwd==7){
				printf("%s is Wicked Sick!\n",p1);
			}else if(h1.kwd==8){
				printf("%s has a Monster Kill!!!\n",p1);
			}else if(h1.kwd==9){
				printf("%s is Godlike!\n",p1);
			}else if(h1.kwd>=10){
				printf("%s is Beyond Godlike! Somebody kill him!!\n",p1);
			}
			if(h1.acc==2){
				printf("%s just got a Double Kill!\n",p1);
			}else if(h1.acc>=3){
				printf("%s just got a Triple Kill!\n",p1);
			}
		}
		printf("\n");
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值