您的位置:首页 > 其它

bnuoj 4207 台风(模拟题)

2013-10-10 19:30 232 查看
http://www.bnuoj.com/bnuoj/problem_show.php?pid=4207

【题意】:中文题,略

【题解】:模拟

【code】:

#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;

struct Nod
{
int t,sh;
}node[3][10];

void init()
{
//XsugarX
node[0][0].t = 15;
node[0][0].sh = 650;

node[0][1].t = 19;
node[0][1].sh = 450;

node[0][2].t = 46;
node[0][2].sh = 1100;

//temperlsyer
node[1][0].t = 9;
node[1][0].sh = 200;

node[1][1].t = 9;
node[1][1].sh = 200;

node[1][2].t = 10;
node[1][2].sh = 400;

node[1][3].t = 10;
node[1][3].sh = 500;

node[1][4].t = 45;
node[1][4].sh = 850;
}

int main()
{
int t;
init();
scanf("%d",&t);
while(t--)
{
int time,p1,p2;
scanf("%d%d%d",&time,&p1,&p2);
int i,atk[3]={0};
int next0=node[0][0].t,next1=node[1][0].t;
int add0=0,add1=0,cnt0=0,cnt1=0;
for(i=0;i<=time;i++)
{
int flag0=0,flag1=0;
if(next0==i)
{
p2-=node[0][cnt0].sh;
cnt0=(cnt0+1)%3;
flag0=1;

}
if(next1==i)
{
p1-=node[1][cnt1].sh;
cnt1=(cnt1+1)%5;
flag1=1;
}
if(flag0)
{
next1+=2;
next0+=node[0][cnt0].t;
}
if(flag1)
{
next1+=node[1][cnt1].t;
next0+=2;
}
if(flag0||flag1)
{

if(p1<=0||p2<=0)
{
break;
}
}
}
if((p1<=0&&p2<=0)||(p1==p2))
{
puts("DRAW");
}
else if(p1>p2)
{
printf("XsugarX %d\n",p1);
}
else if(p1<p2)
{
printf("temperlsyer %d\n",p2);
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: