1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; int main(){ double r = 0,h = 0; cin >> r >> h; double judge = h/r; int res = (int)judge; double remain = h/r-res; //cout << remain << endl; res *= 2; if (remain < 0.5) { res+=1; }else if(remain >= 0.5 && remain < sqrt(3)/2){ res+=2; }else{ res+=3; } cout << res << endl; return 0; } |
这货是几何题, 一图秒懂系列: