ZOJ - 3866 Cylinder Candy 【数学】

mac2022-06-30  28

题目链接

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3866

思路

积分 参考博客 https://blog.csdn.net/u012377575/article/details/45285895

AC代码

#include <cstdio> #include <cstring> #include <ctype.h> #include <cstdlib> #include <cmath> #include <climits> #include <ctime> #include <iostream> #include <algorithm> #include <deque> #include <vector> #include <queue> #include <string> #include <map> #include <stack> #include <set> #include <numeric> #include <sstream> #include <iomanip> #include <limits> #define CLR(a) memset(a, 0, sizeof(a)) #define pb push_back using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair <int, int> pii; typedef pair <ll, ll> pll; typedef pair<string, int> psi; typedef pair<string, string> pss; const double PI = acos(-1); const double E = exp(1); const double eps = 1e-30; const int INF = 0x3f3f3f3f; const int maxn = 5e4 + 5; const int MOD = 1e9 + 7; int main() { int T; cin >> T; while (T--) { int r, h, d; scanf("%d%d%d", &r, &h, &d); double v = (r + d) * (r + d) * PI * h + 2 * (2.0 / 3 * d * d * d * PI + r * d * d * PI * PI * 1.0 / 2 + r * r * d * PI); double s = 2 * (r + d) * PI * h + 2 * PI * r * r + 2 * (PI * PI * r * d + 2 * PI * d * d); printf("%.12lf %.12lf\n", v, s); } }

转载于:https://www.cnblogs.com/Dup4/p/9433143.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)