These will be floating point numbers;看这句话,就是说数据会是浮点型的,

问题(一)数据定义成double类型就过了

我当时以为定义成float类型就可以了,

因为题上说是float point number,但是定义成float类型的却wrong answer,同学让我改成double类型的,我当时问她依据

她说没有依据,你试试呗,我挺固执地继续从别的地方找错误,没有依据?不可能嘛!最后无奈试了一下果真改了类型就对了,

得出一个教训,题上让用的floating point numbers时候,你可以用double类型的数据存储,用不上那么长最后不用后边多余的位数就是了嘛

问题(二)小数点后面有精确到7位才过,8位就不过

还发现一个问题,存储PI的double类型数据,我定义成3.1415926就对了,定义成3.14159265就错了,

可能是后台测评的时候用的PI就是3.1415926,但是我觉得也可以从题中找,题中说是floating point numbers

我想意思就是定义精度为7~8位的数据就可以了,因为float精度7~8位,

ps:我想了下,这道题给出的数据精度7~8位但是算的时候必须定义成double类型的原因是S = PI * R^2;这样一来,

数据就会扩大很多,如果仍然用float类型存,就会丢失精度

Description

Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred is hoping to live in this house the rest of his life, he needs to know if his land is going to be lost to erosion.

After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects the circle being the X axis. Locations below the X axis are in the water. The semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.)

 

Input

The first line of input will be a positive integer indicating how many data sets will be included (N).

Each of the next N lines will contain the X and Y Cartesian coordinates of the land Fred is considering. These will be floating point numbers measured in miles. The Y coordinate will be non-negative. (0,0) will not be given.

 

Output

For each data set, a single line of output should appear. This line should take the form of:

“Property N: This property will begin eroding in year Z.”

Where N is the data set (counting from 1), and Z is the first year (start from 1) this property will be within the semicircle AT THE END OF YEAR Z. Z must be an integer.

After the last data set, this should print out “END OF OUTPUT.”

Notes:

1. No property will appear exactly on the semicircle boundary: it will either be inside or outside.

2. This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines.

3. All locations are given in miles.

 

Sample Input

2
1.0 1.0
25.0 0.0
 

Sample Output

Property 1: This property will begin eroding in year 1.
Property 2: This property will begin eroding in year 20.
END OF OUTPUT.
代码:
#include <stdio.h>
int main()
{
int n, case_num = ;
double x, y;
int t;
scanf("%d", &n);
while(n--)
{
scanf("%lf%lf", &x, &y);
double S = 3.1415926*(x*x + y*y)/2.0;
t = (S / 50.0) + ;
printf("Property %d: This property will begin eroding in year %d.\n", case_num++, t);
}
printf("END OF OUTPUT.\n");
return ;
}

G - I Think I Need a Houseboat(简单题,粘贴下来是因为数据精度需要注意)的更多相关文章

  1. HDU 6106 17多校6 Classes(容斥简单题)

    Problem Description The school set up three elective courses, assuming that these courses are A, B, ...

  2. acm.njupt 1001-1026 简单题

    点击可展开上面目录 Acm.njupt 1001-1026简单题 第一页许多是简单题,每题拿出来说说,没有必要,也说不了什么. 直接贴上AC的代码.初学者一题题做,看看别人的AC代码,寻找自己的问题. ...

  3. 牛客网 牛客小白月赛1 A.简单题-控制输出格式setiosflags()函数+setprecision()函数

    水一水博客,都不好意思写这篇博客,毕竟已经不是大一的了. 难得能把一整套题都写出来(日常智障).但是在这里不写G题あなたの蛙は旅⽴っています的题解. 有毒,G题关了流同步只能过94%的样例,说我运行超 ...

  4. unctf2020 部分简单题题解

    unctf2020 水一波简单题..菜狗前来报道..大佬轻喷..如果有时间做题就好了呜呜呜 misc 1.baba_is_you 题目告诉我们,了解png文件格式. 下载得到一张png格式的图片. 用 ...

  5. BZOJ 2683: 简单题

    2683: 简单题 Time Limit: 50 Sec  Memory Limit: 128 MBSubmit: 913  Solved: 379[Submit][Status][Discuss] ...

  6. 【BZOJ-1176&2683】Mokia&简单题 CDQ分治

    1176: [Balkan2007]Mokia Time Limit: 30 Sec  Memory Limit: 162 MBSubmit: 1854  Solved: 821[Submit][St ...

  7. Bzoj4066 简单题

    Time Limit: 50 Sec  Memory Limit: 20 MBSubmit: 2185  Solved: 581 Description 你有一个N*N的棋盘,每个格子内有一个整数,初 ...

  8. Bzoj2683 简单题

    Time Limit: 50 Sec  Memory Limit: 128 MBSubmit: 1071  Solved: 428 Description 你有一个N*N的棋盘,每个格子内有一个整数, ...

  9. 这样leetcode简单题都更完了

    这样leetcode简单题都更完了,作为水题王的我开始要更新leetcode中等题和难题了,有些挖了很久的坑也将在在这个阶段一一揭晓,接下来的算法性更强,我就要开始分专题更新题目,而不是再以我的A题顺 ...

随机推荐

  1. django分页linaro-django-pagination

    1.安装linaro-django-pagination settings INSTALLED_APPS = ( # ... 'linaro_django_pagination', ) MIDDLEW ...

  2. java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp

    http://stackoverflow.com/questions/13269564/java-lang-classcastexception-oracle-sql-timestamp-cannot ...

  3. BZOJ 1087 互不侵犯King (位运算)

    题解:首先,这道题可以用位运算来表示每一行的状态,同八皇后的搜索方法,然后对于限制条件不相互攻击,则只需将新加入的一行左右移动与上一行相&,若是0则互不攻击,方案可行.对于每种方案,则用递推来 ...

  4. Flex疑难小杂症

    本文主要解决Flex中一些小问题,收集一些小技巧(来自网络及个人经验) flex自动换行问题  有时候由于label .button等控件中需要用到text属性显示出文本,文本太长就涉及到换行问题,解 ...

  5. [Django实战] 第8篇 - 分页列表

    当用户登录成功后,首先看到的是他自己之前提交的任务列表,本篇将实现该页面. 视图(views.py)里定义如下: from django.core.paginator import Paginator ...

  6. SQL server 数据库视频总结

    用了半个多月的时间把,浙江大学耿建玲老师 数据库视频看了一遍.在看视频之前,曾经接收了一个学生信息管理系统,在学习  学生信息管理系统的时候,对于数据库的部分,总是那么一知半解.带着疑惑来看耿建玲老师 ...

  7. WiFi密码破解CDlinux

    好了,先说下提前要准备的东东吧:1.U盘一枚,最小1G空间.需进行格式化操作,提前保存内部文件.2.CDlinux镜像.帖子最后会提供一枚8月最新修改版,共135M. 1.CDlinux U盘启动  ...

  8. 80x86汇编小站站长简单介绍

    [人生格言] 1] 一生都用头脑而不是情绪解决这个问题 2] 仅仅有偏执狂才会成功 3] 在最困难时都要保持一份幽默感 4] 吾生也有涯,而知也无涯,以有涯随无涯,殆已 [简历] 我的生日: 1981 ...

  9. POJ 3228Gold Transportation(二分+最大流)

    题目地址:POJ3288 这个题跟之前的一道题混了,感觉是一样的,所以连想都没怎么想就拆点然后求最短路然后二分求最大流了.结果连例子都只是,还一直以为又是哪里手残了..结果看了看例子,手算也确实不正确 ...

  10. PE框架学习之道:PE框架——style的配置

    1.在style.xml中定义style     <style id="NumberStyle"> <setting> <param name=&qu ...