当前位置:网站首页>【暑期每日一题】洛谷 P6320 [COCI2006-2007#4] SIBICE
【暑期每日一题】洛谷 P6320 [COCI2006-2007#4] SIBICE
2022-07-29 07:08:00 【AC_Dragon】
题目链接:P6320 [COCI2006-2007#4] SIBICE - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
题目背景
年轻的 Mirko 把火柴扔的到处都是。他的母亲希望他将火柴放入盒子中。
题目描述
Mirko 现在要放置 n 根火柴,他有一个 w×h 的矩形盒子。
他现在想请你进行判断这 n 根火柴每一个是否能够放入这个盒子。
我们可以把盒子看成一个平面,只需要判断火柴是否能够在这个平面内放下即可。
输入格式
输入第一行为三个整数 n,w,h。
接下来的 n 行,每行一个 [1,1000] 区间内的整数,表示一根火柴的长度。
输出格式
输出共 n 行,对于每根火柴,输出 DA 表示能放下,否则输出 NE 表示放不下。
样例 #1
样例输入 #1
5 3 4
3
4
5
6
7样例输出 #1
DA
DA
DA
NE
NE样例 #2
样例输入 #2
2 12 17
21
20样例输出 #2
NE
DA提示
数据规模与约定
对于 100% 的数据,保证 1 <= n <= 50,1 <= w,h <= 100。
说明
题目译自 COCI2006-2007 CONTEST #4 T1 SIBICE
AC code:
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int n;
cin>>n;
int a,b;
cin>>a>>b;
double c; // 对角线长度
c=sqrt(a*a+b*b);
while(n--)
{
int x;
cin>>x;
if(x<=c)
cout<<"DA"<<endl;
else
cout<<"NE"<<endl;
}
return 0;
}边栏推荐
- Vue router route cache
- After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is
- 如何使用gs_expansion扩展节点
- QT basic day 2 (2) QT basic components: button class, layout class, output class, input class, container and other individual examples
- vue-router路由缓存
- 2-统一返回类DTO对象
- 女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
- QT topic: basic components (button class, layout class, output class, input class, container class)
- logback 中FileAppender具有什么功能呢?
- zip gzip tar压缩进阶版
猜你喜欢

Variables and encryption in ansible

WPF nested layout case

Thoroughly understand kubernetes scheduling framework and plug-ins

彻底搞懂kubernetes调度框架与插件

QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例

Remote invocation of microservices

一篇长文---深入理解synchronized

js第四天流程控制(if语句和switch语句)

如何与斯堪尼亚SCANIA建立EDI连接?

Why does ETL often become ELT or even let?
随机推荐
【WPF】通过动态/静态资源实现语言切换
美智光电IPO被终止:年营收9.26亿 何享健为实控人
Custom events
Summary of OCR optical character recognition methods
Excel file reading and writing (creation and parsing)
Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)
When NPM is installed, it is stuck. There are five solutions
MySQL如何把行转换为列?
log4j Layout简介说明
【OpenGL】着色器(Shader)的使用
【Unity实战100例】Unity万能答题系统之单选多选判断题全部通用
Problems encountered in vmware16 installing virtual machines
7-2 calculate the area and perimeter of a regular pentagon (25 points)
Redis Basics
2022-07-28: what is the output of the following go language code? A:AA; B:AB; C:BA; D:BB。 package main import ( “fmt“ ) func main() { f
Introduction to logback appender
Operator3 - design an operator
mysql 单表最多能存多少数据?
zip gzip tar压缩进阶版
After 4 years of development and 13K, if you want to change to automated testing, can your salary still rise···