POJ 1005.I Think I Need a Houseboat

来源:互联网 发布:淘宝可以卖杂货吗 编辑:程序博客网 时间:2024/05/13 20:23

题目:http://icpc.njust.edu.cn/Problem/Pku/1005/

AC代码(C++):

#include <iostream>#include <stdio.h>#include <algorithm>#include <iomanip>#include <string.h>#include <map>#include <math.h>using namespace std;#define PI 3.141592653int main(void) {int n;cin >> n;double* a;double* b;int* m;a = new double[n];b = new double[n];m = new int[n];for (int i = 0; i < n; i++) {cin >> a[i] >> b[i];double l = sqrt(a[i] * a[i] + b[i] * b[i]);double area = l*l*PI / 2;int mm = area / 50;m[i] = mm + 1;}for (int i = 0; i < n; i++) {cout << "Property " << i + 1 << ": This property will begin eroding in year " << m[i] << ".\n";}cout << "END OF OUTPUT.";//system("pause");}

总结:水题

0 0
原创粉丝点击