POJ 1005 I Think I Need a Houseboat
晕死,这道题居然卡在了英语上。在讨论区有人给出了大致的意思
写道
大体意思:
半圆表示一块面积可扩展的区域,开始时,面积是0,在(0,0)处开始以每年50平方米的速度同样呈半圆扩展,输入一个正整数N,然后输入N对坐标,对于每一对坐标值:求出面积扩展到该点的年数,坐标值单位为米。
有了中文帮助,直接秒杀此题。唉,英语啊~~~
代码如下:
import java.util.Scanner;
public class Main {
public int calcYear(double x, double y) {
double r = x * x + y * y;
double s = r * Math.PI / 2d / 50d;
return (int) Math.ceil(s);
}
public void run() throws Exception {
Scanner scan = new Scanner(System.in);
int input = scan.nextInt();
for (int i = 0; i < input; i++) {
int year = calcYear(scan.nextDouble(), scan.nextDouble());
System.out.println("Property " + (i + 1) + ": This property will begin eroding in year " + year + ".");
}
System.out.println("END OF OUTPUT.");
}
public static void main(String[] args) {
Main m = new Main();
try {
m.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
分享到:
相关推荐
北大POJ1005-I Think I Need a Houseboat 解题报告+AC代码
I Think I Need a Houseboat Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 41126 Accepted: 16537 Description Fred Mapper is considering purchasing some land in Louisiana to build his ...
北大ACM算法中的题目,具体题目代号为1005
北大POJ第1005题答案(C语言)
北大POJ1584-A Round Peg in a Ground Hole 解题报告+AC代码
POJ1584 -A Round Peg in a Ground Hole 测试数据。数据来源 Mid-Atlantic 2003 问题D
解决poj1005买地问题,涉及几何计算
#include #include int main() { int a[100],j=1,i,n,m; scanf("%d%d",&n,&m); for(i=0;i;i++) scanf("%d",&a[i]); for(i=0;i;i++) if(a[i]>a[m]) j++; printf("%d",j++); return 0; }
}else if( a[i] == max ){ t++; } } string str = "independent"; if( t == 0 && v != 0){ if( name[v] == str ){ printf("independent\n"); }else{ cout [v] ; } }else if...
#include #define PI 3.1415926 int main() { int n,i,m,arr[100];... printf("Property %d: This property will begin eroding in year %d.\n",i,arr[i]); } printf("END OF OUTPUT.\n"); return 0; }
北大POJ2031-Building a Space Station【Prim+计算几何】 POJ2031-Building a Space Station【Prim+计算几何】
北大POJ2488-A Knight's Journey 解题报告+AC代码
int i; int value = 0; for( i = 0 ; i ; i++ ){ s[value++] = s2[i]; s[value++] = s1[i]; } s[value] = '\0'; } int main() { freopen( "in.txt" , "r" , stdin ); freopen( "out.txt" , "w" , ...
北大POJ1942-Paths on a Grid 解题报告+AC代码
poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题...
POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类
西北工业大学 C 语言 POJ 题目及答案第七季 该文档提供了西北工业大学 POJ(Programming Online Judge)平台上的 C 语言编程题目及答案,共计 7 题,涵盖了基本数据类型、运算符、控制结构、函数和数组等 C 语言...
#include using namespace std; #define M 1000000 char t[M+1],p[M+1];... int i,j; for(i=lenp,j=0;i;i++) { if(t[i]!=p[j]) return false; if(t[i]==p[j]) j++; if(j==lenp) j=0; } return true; }
北大POJ1691-Painting A Board 【拓扑+DFS】 解题报告+AC代码
The standard form of a telephone number is seven decimal digits with a hyphen between the third and fourth digits (e.g. 888-1200). The keypad of a phone supplies the mapping of letters to numbers, as ...