题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1107

注意:1.路线是要反向的,走不通就反向;

2.输入输出全部是整形

3.攻击力不断变化

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
struct Node{
int x,y,fg;
int nei,wu,she,gj,dir;
char ch;
int f(char tt)
{
if(tt=='S') return floor((0.5*nei+0.5*wu)*(she+10.0)/100.0);
else if(tt=='W') return floor((0.8*nei+0.2*wu)*(she+10.0)/100.0);
else if(tt=='E') return floor((0.2*nei+0.8*wu)*(she+10.0)/100.0);
}
};
int check(int x,int y)
{
if(x<||y>) return ;
if(y<||x>) return ;
else return ;
}
Node a[];
int vis[][],vc[];
int main(void)
{
int i,t,n,len,k,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
getchar();
i=;
while(scanf("%c",&a[i].ch)&&(a[i].ch!=''))
{
scanf(" %d %d %d %d %d",&a[i].x,&a[i].y,&a[i].nei,&a[i].wu,&a[i].she);
a[i].dir=;
getchar();
i++;
}
// cout<<"---"<<i<<endl;
len=i;
for(i=;i<len;i++)
{
if(a[i].ch=='S') a[i].fg=;
else if(a[i].ch=='W') a[i].fg=;
else if(a[i].ch=='E') a[i].fg=;
a[i].gj=a[i].f(a[i].ch);
//cout<<a[i].gj<<endl;
}
//cout<<n<<" --1i4dfjsdofsd\n";
for(i=;i<n;i++)
{
memset(vis,,sizeof(vis));
memset(vc,,sizeof(vc));
for(j=;j<len;j++)
{
vis[a[j].x][a[j].y]++;
}
for(j=;j<len;j++)
{
for(k=;k<len;k++)
{
if((a[j].fg!=a[k].fg)&&j!=k&&a[j].fg!=-&&vis[a[j].x][a[j].y]==&&vc[j]==&&vc[k]==&&(a[j].x==a[k].x&&a[j].y==a[k].y))
{
a[j].she=a[j].she-a[k].gj;
a[k].she=a[k].she-a[j].gj;
//cout<<a[k].gj<<" ----- "<<a[j].gj<<endl;
a[k].gj=a[k].f(a[k].ch);
a[j].gj=a[j].f(a[j].ch);
vc[j]=;vc[k]=;
if(a[j].she<=) a[j].fg=-;
if(a[k].she<=) a[k].fg=-;
}
}
}
for(j=;j<len;j++) //移动
{
if(a[j].ch=='S')
{
a[j].x+=a[j].dir;
if(check(a[j].x,a[j].y)==)
{
a[j].dir*=(-);
a[j].x+=*a[j].dir;
}
}
else if(a[j].ch=='W')
{
a[j].y+=a[j].dir;
if(check(a[j].x,a[j].y)==)
{
a[j].dir*=(-);
a[j].y+=*a[j].dir;
}
}
else if(a[j].ch=='E')
{
if(a[j].x==&&a[j].y==||a[j].x==&&a[j].y==) continue;
a[j].x+=a[j].dir,a[j].y+=a[j].dir;
if(check(a[j].x,a[j].y)==)
{
a[j].dir*=(-);
a[j].x+=*a[j].dir;
a[j].y+=*a[j].dir;
}
}
}
}
int ans1=,ans2=,ans3=;
int num1=,num2=,num3=;
for(i=;i<len;i++)
{
if(a[i].fg==) num1++,ans1+=a[i].she;
else if(a[i].fg==) num2++,ans2+=a[i].she;
else if(a[i].fg==) num3++,ans3+=a[i].she;
}
printf("%d %d\n",num1,ans1);
printf("%d %d\n",num2,ans2);
printf("%d %d\n",num3,ans3);
printf("***\n");
}
return ;
}

hdu-1107(模拟题)的更多相关文章

  1. hdu 4801模拟题

    /* 模拟: 注意:实质上一次魔方的一半要变化 用c++超内存 用g++过了 */ #include<stdio.h> #include<string.h> #include& ...

  2. HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011亚洲北京赛区网络赛)

    HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 ...

  3. HDU 4452 Running Rabbits (模拟题)

    题意: 有两只兔子,一只在左上角,一只在右上角,两只兔子有自己的移动速度(每小时),和初始移动方向. 现在有3种可能让他们转向:撞墙:移动过程中撞墙,掉头走未完成的路. 相碰: 两只兔子在K点整(即处 ...

  4. hdu 5641 King's Phone(暴力模拟题)

    Problem Description In a military parade, the King sees lots of new things, including an Andriod Pho ...

  5. HDU 1262 寻找素数对 模拟题

    题目描述:输入一个偶数,判断这个偶数可以由哪两个差值最小的素数相加,输出这两个素数. 题目分析:模拟题,注意的是为了提高效率,在逐个进行判断时,只要从2判断到n/2就可以了,并且最好用打表法判断素数. ...

  6. HDU 2093 考试排名 模拟题

    解题报告: 题目描述:写一个程序给一个编程考试C++实时提交系统排名,给你的数据是题目的总数,每次错误提交罚的时间分,每位用户的姓名,然后是输入用户每题的完成情况,有一下几种情况,第一,输入只有一个正 ...

  7. hdu 4706:Children's Day(模拟题,模拟输出大写字母 N)

    Children's Day Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  8. HDU 2414 Chessboard Dance(模拟题,仅此纪念我的堕落)

    题目 模拟题也各种wa,我最近真的堕落了,,,,,智商越来越为负数了!!!!!!!! #include<stdio.h> #include<string.h> #include ...

  9. POJ 模拟题集合

    http://www.cppblog.com/Uriel/articles/101592.html 感觉这个暑假没有去年有激情啊,,,还没到状态就已经块上学了,,, 真是弱暴了,,,找几道模拟题刷刷. ...

  10. poj 1008:Maya Calendar(模拟题,玛雅日历转换)

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 D ...

随机推荐

  1. jdk升级到9,eclipse打不开

    jdk从1.8到1.9之后删除了不少之前Deprecated的类. eclipse 版本oxygen和neon对应jdk1.8 eclipse 版本luna和mars对应jdk1.7,1.6 在打开e ...

  2. python 3 属性查找与绑定方法

    1.属性查找 类有两种属性:数据属性和函数属性 (1)类的数据属性是所有对象共享的 #类的数据属性是所有对象共享的,id都一样 class OldboyStudent: school='oldboy' ...

  3. 基于Sentinel的Redis3.2高可用方案

    默认情况下,Redis node和sentinel的protected-mode都是yes,在搭建集群时,若想从远程连接redis集群,需要将redis.conf和sentinel.conf的prot ...

  4. Haskell语言学习笔记(49)ByteString Text

    Data.ByteString String 是 [Char] 的同义词,在使用上存在List的惰性所带来的性能问题. 在处理大型二进制文件时,可以使用 ByteString 来代替 String. ...

  5. a,b = b,a 换值问题

    a = "hello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhe ...

  6. 吴裕雄 数据挖掘与分析案例实战(14)——Kmeans聚类分析

    # 导入第三方包import pandas as pdimport numpy as np import matplotlib.pyplot as pltfrom sklearn.cluster im ...

  7. threading实例

    import paramiko, threading import queue import pymysql class ThreadPool(object): def __init__(self, ...

  8. c# 结构体 集合 复习

    添加5个学生的信息到集合中,每个学生都有:学号,姓名,成绩,3个内容,添加完毕后将学生的分数从高到低排列并打印出来,使用结构体 using System; using System.Collectio ...

  9. Mysql 多个字段查找重复数

    delete FROM `test_table` WHERE id in (SELECT id,concat(user_id,user_id2) as __fFROM `test_table` whe ...

  10. HttpClient 发送 HTTP、HTTPS

    首先说一下该类中需要引入的 jar 包,apache 的 httpclient 包,版本号为 4.5,如有需要的话,可以引一下.     代码 import org.apache.commons.io ...