Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:留念一下In Reply To:留念一下 Posted by:Godwind at 2009-09-10 15:38:40 #include <iostream> using namespace std; double GetR2(int year) { if(year == 0) { return 0; } else { return 100/3.14159 + GetR2(year-1); } } int GetZ(double doubleR) { for(int i=1; true; ++i) { if(GetR2(i) >= doubleR) { return i; } } } int main() { int m = 0; cin >> m; double x, y; x = y = 0.0; for(int i=0; i<m; ++i) { cin >> x >> y; cout << "Property " << i+1 << ": This property will begin eroding in year " << GetZ(x*x + y*y) << "." << endl; } cout << "END OF OUTPUT." << endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator