poj 1005

来源:互联网 发布:js常用正则表达式大全 编辑:程序博客网 时间:2024/06/05 13:26
#include <iostream>#include <vector>int main(){int i, n;std::vector<float> v;std::cin>>n;v.resize(n*2);for(i=0; i<n; i++)std::cin>>v[i*2]>>v[i*2+1];for(i=0; i<n; i++){std::cout<<"Property "<<i+1<<": This property will begin eroding in year "<<int((v[i*2]*v[i*2]+v[i*2+1]*v[i*2+1])*3.14/100+1)<<".\n";}std::cout<<"END OF OUTPUT.";return 0;}

11068636dragoo11005Accepted244K0MSC++388B2012-12-01 16:20:01


做这题的时候巨水,还不如小学生,

刚开始居然用max(x,y)*max(x,y)来算,后来Wrong answer,习惯用百度,结果是x*x+y*y,测试用例(25.0,25.0)就得侵蚀40年,而非25年

参考:http://blog.sina.com.cn/s/blog_894066430100tf1n.html