1049_I Think I Need a Houseboat
来源:互联网 发布:在北京做程序员好吗 编辑:程序博客网 时间:2024/05/20 21:18
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 Format:
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 Format:
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<iostream>
#include<string>
using namespace std;
int main()
{
string ss(".!X#");
const int max=20;
int count;
int days;//模拟几天
int rule[16];
int square[max][max],trans[max][max];//trans[][]用于过渡,因为square[][]的一个元素处理过后,隔壁元素还要用未出理前的那个元素
int num;
cin>>count;
while(count--)
{
cin>>days;
for(int i=0;i!=16;i++)
cin>>rule[i];
for(int i=0;i!=max;i++)
for(int j=0;j!=max;j++)
cin>>square[i][j];
while(days--)
{
for(int i=0;i!=max;i++)
for(int j=0;j!=max;j++)
{
num=square[i][j];
if(j-1>=0)//临界检测
num+=square[i][j-1];
if(i-1>=0)
num+=square[i-1][j];
if(j+1<max)
num+=square[i][j+1];
if(i+1<max)
num+=square[i+1][j];
trans[i][j]=square[i][j]+rule[num];//处理
if(trans[i][j]<0)
trans[i][j]=0;
if(trans[i][j]>3)
trans[i][j]=3;
}
for(int i=0;i!=max;i++)
for(int j=0;j!=max;j++)
square[i][j]=trans[i][j];
}
for(int i=0;i!=max;i++)
{
for(int j=0;j!=max;j++)
cout<<ss[square[i][j]];
cout<<endl;
}
if(count!=0)//每个测试隔一行,最后一个后面就没有
cout<<endl;
}
return 0;
}
- 1049_I Think I Need a Houseboat
- POJ 1005_I Think I Need a Houseboat
- 1049 I Think I Need a Houseboat
- ZOJ 1049 I Think I Need a Houseboat
- ZOJ 1049 I Think I Need a Houseboat
- HDU 1065 || ZOJ 1049 I Think I Need a Houseboat
- ZOJ Problem Set - 1049 I Think I Need a Houseboat
- ZOJ 1049 I Think I Need a Houseboat
- ZOJ 1049 I Think I Need a Houseboat
- ZOJ Problem Set - 1049 I Think I Need a Houseboat
- ZOJ 1049 &&HDU 1065 I Think I Need a Houseboat
- ZOJ Problem Set - 1049||I Think I Need a Houseboat
- ZOJ 1049 I Think I Need a Houseboat
- ZOJ 1049 I Think I Need a Houseboat
- ZOJ--1049:I Think I Need a Houseboat
- ZOJ 1049 (I Think I Need a Houseboat)
- 【大水题】ZOJ 1049 I Think I need a Houseboat
- I Think I Need a Houseboat
- Air Mobile As3 App
- 国际著名黑客大赛介绍与比较
- 1051_A New Growth Industry
- 破那个垃圾安全狗技术总汇
- ORA-00093: pga_aggregate_target must be between 10M and 4096G-1
- 1049_I Think I Need a Houseboat
- 卷积和积分运算
- C#static
- 内部类总结
- android viewanimator viewfilter viewswitcher textswitcher imageswitcher
- 1048_Financial Management
- 使索引临时失效
- Pentium III处理器的单指令多数据流扩展指令入门
- 配置篇-安装openlaszlo平台及IDE