Coder-Strike 2014 - Qualification Round C. Kicker(推理题)

1、http://codeforces.com/contest/411/problem/C

2、题目大意:

有两个队,每个队有两个人,每个人都有攻击力和防御力两个值,现在第一队先确定那一个人防御,哪一个人攻击;第二队再根据第一队的决定,确定自己队伍哪个人负责防御,哪个人负责攻击;其中在没有确定之前,双方都知道对方的实力,输出谁赢输还是平局

3、解题思路

假设第一队的两个人的两种组合分别是1,2;第二队的两种组合分别是3,4;

if( (1>3&&1>4)  || (2>3&&2>4) )时一队肯定赢

if( (3>1||4>1)  && (3>2||4>2) )时二队肯定赢

否则就是平局

4、题目:

C. Kicker
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Kicker (table football) is a board game based on football, in which players control the footballers' figures mounted on rods by using bars to get the ball into the opponent's goal. When playing two on two, one player of each team controls the goalkeeper and the full-backs (plays defence), the other player controls the half-backs and forwards (plays attack).

Two teams of company Q decided to battle each other. Let's enumerate players from both teams by integers from1 to 4. The first and second player play in the first team, the third and the fourth one play in the second team. For each of the four players we know their game skills in defence and attack. The defence skill of the i-th player is ai, the attack skill is bi.

Before the game, the teams determine how they will play. First the players of the first team decide who will play in the attack, and who will play in the defence. Then the second team players do the same, based on the choice of their opponents.

We will define a team's defence as the defence skill of player of the team who plays defence. Similarly, a team's attack is the attack skill of the player of the team who plays attack. We assume that one team is guaranteed to beat the other one, if its defence is strictly greater than the opponent's attack and its attack is strictly greater than the opponent's defence.

The teams of company Q know each other's strengths and therefore arrange their teams optimally. Identify the team that is guaranteed to win (if both teams act optimally) or tell that there is no such team.

Input

The input contain the players' description in four lines. The i-th line contains two space-separated integers ai and bi (1 ≤ ai, bi ≤ 100) — the defence and the attack skill of thei-th player, correspondingly.

Output

If the first team can win, print phrase "Team 1" (without the quotes), if the second team can win, print phrase "Team 2" (without the quotes). If no of the teams can definitely win, print "Draw" (without the quotes).

Sample test(s)
Input
1 100
100 1
99 99
99 99
Output
Team 1
Input
1 1
2 2
3 3
2 2
Output
Team 2
Input
3 3
2 2
1 1
2 2
Output
Draw
Note

Let consider the first test sample. The first team can definitely win if it will choose the following arrangement: the first player plays attack, the second player plays defence.

Consider the second sample. The order of the choosing roles for players makes sense in this sample. As the members of the first team choose first, the members of the second team can beat them (because they know the exact defence value and attack value of the first team).

5、AC代码:

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a1[6];
int b1[6];
struct node
{
    int a;
    int b;
} c[10];
int checkdy(int i,int j)
{
    if(c[i].a>c[j].b && c[i].b>c[j].a)
        return 1;
    return 0;
}
int main()
{
    for(int i=1; i<=4; i++)
    {
        scanf("%d%d",&a1[i],&b1[i]);
    }
    c[1].a=a1[1];
    c[1].b=b1[2];
    c[2].a=a1[2];
    c[2].b=b1[1];
    c[3].a=a1[3];
    c[3].b=b1[4];
    c[4].a=a1[4];
    c[4].b=b1[3];
    if(((checkdy(1,3)) && (checkdy(1,4))) || ((checkdy(2,3)) && (checkdy(2,4))))
    {
        printf("Team 1\n");
    }
    else if(((checkdy(3,1))||(checkdy(4,1))) && (checkdy(3,2)||checkdy(4,2)))
    {
        printf("Team 2\n");
    }
    else
    {
        printf("Draw\n");
    }
    return 0;
}


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值