codeforces 342C Cupboard and Balloons(公式题)
2015-03-30 00:13
218 查看
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud
C. Cupboard and Balloons
A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h + rfrom the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right).
代码君
C. Cupboard and Balloons
A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h + rfrom the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right).
//##################### //Author:fraud //Blog: http://www.cnblogs.com/fraud/ //##################### #include <iostream> #include <sstream> #include <ios> #include <iomanip> #include <functional> #include <algorithm> #include <vector> #include <string> #include <list> #include <queue> #include <deque> #include <stack> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <climits> #include <cctype> using namespace std; #define XINF INT_MAX #define INF 0x3FFFFFFF #define MP(X,Y) make_pair(X,Y) #define PB(X) push_back(X) #define REP(X,N) for(int X=0;X<N;X++) #define REP2(X,L,R) for(int X=L;X<=R;X++) #define DEP(X,R,L) for(int X=R;X>=L;X--) #define CLR(A,X) memset(A,X,sizeof(A)) #define IT iterator typedef long long ll; typedef pair<int,int> PII; typedef vector<PII> VII; typedef vector<int> VI; int main() { ios::sync_with_stdio(false); double r,h; while(cin>>r>>h){ double tmp=(h+r/2); int ans=(int)(tmp/r+1e-8); tmp-=ans*r; ans*=2; tmp+=r/2; if(tmp-r*(sqrt(3.0)/2)>-1e-12)ans++; cout<<ans<<endl; } return 0; }
代码君
相关文章推荐
- CodeForces 342C Cupboard and Balloons (几何问题)
- CodeForces 342C Cupboard and Balloons
- CF 342C(Cupboard and Balloons-难得对的贪心)
- codeforces 476C 推公式
- CodeForces 342C
- Codeforces 382 B. Number Busters(数论推公式)
- CodeForces 342C--矩形盒子能最多放多少个球
- Civilization CodeForces - 455C (并查集+树的直径+推公式 +链式前向星存储边)
- CodeForces - 630Q Pyramids (数学几何&公式)
- 分析公式 Codeforces 528B Clique Problem
- CodeForces 597A(公式+技巧)
- codeforces 599D. Spongebob and Squares【推公式+暴力枚举】
- Codeforces 839D Winter is here【容斥原理+数学公式】
- codeforces 839D (推公式+容斥原理/莫比乌斯函数)
- Codeforces 599D Spongebob and Squares 【公式推导 暴力】
- Codeforces 696C PLEASE 概率(推公式)
- 推公式 codeforces 226A
- CodeForces 659 D. Bicycle Race(计算几何 + 数学公式)
- CodeForces 630Q Pyramids(数学公式)
- codeforces 650 C. Watchmen(数学公式)