当前位置:网站首页>【暑期每日一题】洛谷 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;
}边栏推荐
猜你喜欢

How does MySQL convert rows to columns?

Variables and encryption in ansible

Ansible中的变量及加密

Redis Basics

After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is

Docker最新超详细教程——Docker创建运行MySQL并挂载

PAT甲级 1146 拓扑顺序

gcc/g++的使用

Operator3 - design an operator

微服务远程调用
随机推荐
Introduction to logback appender
【OpenGL】着色器(Shader)的使用
使用自定义注解校验list的大小
SpingBoot整合Quartz框架实现动态定时任务(支持实时增删改查任务)
Docker最新超详细教程——Docker创建运行MySQL并挂载
After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is
Scala higher order (10): exception handling in Scala
1 - background project construction
09 bloom filter
Error 1045 (28000) access denied for user 'root' @ 'localhost' solution
WPF nested layout case
Variables and encryption in ansible
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
Reflect reflect
Introduction to log4j layout
0 8 动态规划(Dynamic Programming)
Gin template
1-后台项目搭建
do end用法的妙处
How does MySQL convert rows to columns?