o.boj 1051 SIBICE

注:最近这一系列ACM的内容,都是2年多之前的代码,自己回顾一下。

SIBICE
 
Submit: 941   Accepted:630
Time Limit: 1024MS  Memory Limit: 65536K
Description
Young Mirko threw matches all over the floor of his room.
His mom did not like that and ordered him to put all the matches in a box. Mirko soon noticed that not all of the matches on the floor fit in the box, so he decided to take the matches that don't fit and throw them in the neighbour's garbage, where his mom (hopefully) won't find them.
Help Mirko determine which of the matches fit in the box his mom gave him. A match fits in the box if its entire length can lie on the bottom of the box. Mirko examines the matches one by one.


Input
The first line of input contains an integer N (1 ≤ N ≤ 50), the number of matches on the floor, and two integers W and H, the dimensions of the box (1 ≤ W ≤ 100, 1 ≤ H ≤ 100).
Each of the following N lines contains a single integer between 1 and 1000 (inclusive), the length of one match.


Output
For each match, in the order they were given in the input, output on a separate line "DA" if the match fits in the box or "NE" if it does not.


Sample Input

2 12 17
21
20


Sample Output

NE
DA


Hint
If Jimmy bond 1 is assigned the 3rd mission, Jimmy Bond 2 the 1st mission and Jimmy Bond 3 the 2nd mission the probability is: 1.0 * 0.13 * 0.7 = 0.091 = 9.1%. All other arrangements give a smaller probability of success.


Source
Croatian Open Competition in Informatics
 
 
简单的模拟题

#include<stdlib.h>
#include<stdio.h>

main()
{
    int N, W, H, len;
    int maxlen;
    
    scanf("%d %d %d", &N, &W, &H);
    
    maxlen = W * W + H * H;
        
    while (N--)
    {
        scanf ("%d", &len);
        if ((len * len) <= maxlen)
            printf("DA\n");
        else
            printf("NE\n");    
    }
    // system("pause");
}


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值