博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AtCoder Beginner Contest 113 B - Palace
阅读量:4364 次
发布时间:2019-06-07

本文共 1379 字,大约阅读时间需要 4 分钟。

Problem Statement

A country decides to build a palace.

In this country, the average temperature of a point at an elevation of x meters is Tx×0.006 degrees Celsius.

There are N places proposed for the place. The elevation of Place i is Hi meters.

Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.

Print the index of the place where the palace should be built.

It is guaranteed that the solution is unique.

Constraints

  • 1≤N≤1000
  • 0≤T≤50
  • −60≤AT
  • 0≤Hi≤105
  • All values in input are integers.
  • The solution is unique.

Input

Input is given from Standard Input in the following format:

NT AH1 H2 … HN

Output

Print the index of the place where the palace should be built.


Sample Input 1

Copy

212 51000 2000

Sample Output 1

Copy

1
  • The average temperature of Place 1 is 12−1000×0.006=6 degrees Celsius.
  • The average temperature of Place 2 is 12−2000×0.006=0 degrees Celsius.

Thus, the palace should be built at Place 1.


Sample Input 2

Copy

321 -1181234 94124 52141

Sample Output 2

Copy

3
#include
#include
using namespace std;double s[100000];int main(){ int n,m,j,k,i,t,ans,T,a,b; cin>>n; cin>>a>>b; for (i=0;i
>s[i]; s[i] = a - 0.006*s[i]; } double min = 1000000000.0; for (i=0;i

 

转载于:https://www.cnblogs.com/Romantic-Chopin/p/10253054.html

你可能感兴趣的文章
JS Fetch
查看>>
EJB 笔记
查看>>
【delete】Android自定义控件(四) 自定义ImageView动态设置ImageView的高度
查看>>
HDUOJ------(1230)火星A+B
查看>>
Servlet
查看>>
基于jquery地图特效全国网点查看代码
查看>>
【leetcode】867 - Transpose Matrix
查看>>
selenium动作链
查看>>
《设计你的人生》的部分经典语录
查看>>
mustache多次渲染和多个赋值
查看>>
Web 前端开发精华文章推荐(HTML5、CSS3、jQuery)【系列二十三】
查看>>
linux-nohup命令
查看>>
[LeetCode OJ] Roman to Integer
查看>>
三次握手和四次挥手
查看>>
Redis的简单动态字符串实现
查看>>
putty network error:software caused connection abort
查看>>
存储过程 <3> 和函数的区别
查看>>
高级service之ipc ADIL用法
查看>>
Django框架-基础篇
查看>>
Leetcode: Binary Tree Maximum Path Sum
查看>>