ZOJ 3866 Cylinder Candy (浙大校赛+积分应用)

题目链接:ZOJ 3866 Cylinder Candy

题意:抽象出来就是求一个圆柱体外面加一层厚度为d的巧克力,求包装完这个立体图形的体积和表面积。

剖析:

以下是包装后的三视图:

图3

接下里就是积分了

2*V1是图3绕y轴的体积

V2是中间的半径为(r+d)的圆柱体积

S1是中间的半径为(r+d)的圆柱的表面积

S2是上下两个半径为r的圆的面积

S3是图3绕y轴的侧面积

附上旋转体的侧面积和体积求法:

AC代码:

#include <stdio.h>
#include <math.h>
#define PI acos(-1.0)
int main(){
    double r,h,d;
    int t;
    scanf("%d",&t);
    while(t--){
        scanf("%lf %lf %lf",&r,&h,&d);
        double v=2*(2.0/3*d*d*d*PI+r*d*d*PI*PI/2.0+r*r*d*PI)+(r+d)*(r+d)*PI*h;
        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);
    }
return 0;
}
时间: 2024-10-11 00:49:51

ZOJ 3866 Cylinder Candy (浙大校赛+积分应用)的相关文章

ZOJ - 3866 Cylinder Candy (数学,积分)

Cylinder Candy Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu Submit Status Description Edward the confectioner is making a new batch of chocolate covered candy. Each candy center is shaped as a cylinder with radius r mm an

ZOJ 3866 Cylinder Candy

Cylinder Candy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Edward the confectioner is making a new batch of chocolate covered candy. Each candy center is shaped as a cylinder with radius r mm and height h mm. The candy center

15th浙大校赛 zoj3860-3868

比赛链接: here 题目对应到ZOJ3860~3868 A Find the Spy 水 #include<cstdio> #include<map> #include<cstring> #include<iostream> using namespace std; map<int,int>mp; map<int,int>::iterator it; int main() { int T,n,x; scanf("%d&qu

2017 浙大校赛 [Cloned]

https://vjudge.net/contest/285902#overview A.Marjar Cola #include <bits/stdc++.h> using namespace std; int T; int main() { scanf("%d", &T); while(T --) { int x, y, a, b; int ans = 0; scanf("%d%d%d%d", &x, &y, &a,

2019 浙大校赛解题过程及题解

解题过程  开场lfw看J,被孪生素数误导,没有看出水题的本质,byf及时提醒后,lfw忘记N=1的情况要特判.之后byf写E,忘记开long long,wa+1.Shl看出A题思路,告诉lfw开始写A,lfw忘记先排序,WA+1.byf看出B题做法,lfw写java过掉,shl与lfw讨论G,lfw开始写G,byf看出C可以hash暴力,lfwG忘记清空一个值,导致特殊情况会加两次,wa+1,byf使用mp作hash,带logn常数TLE,随后转成long long的hash值,使用unord

2019浙大校赛--J--Extended Twin Composite Number(毒瘤水题)

毒瘤出题人,坑了我们好久,从基本的素数筛选,到埃氏筛法,到随机数快速素数判定,到费马小定理,好好的水题做成了数论题. 结果答案是 2*n=n+3*n,特判1,2. 以下为毒瘤题目: 题目大意: 输入一个数n, 输出两个合数(即非素数)a,b 实现 n+a=b 解题思路 3n=n+2n; 特判1.2 代码: 1 #include<iostream> 2 #include<stdio.h> 3 using namespace std; 4 typedef long long ll; 5

[水]浙大校赛补题

本来以为会巨难无比又有别的比赛可以打于是赛后补题,结果发现似乎略水,反正是找到了四个水题先贴下来 ZOJ-4099 J #include<iostream> #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int t; ll x, y, n; int main() { cin >> t; while (t--) { scanf("%lld

浙大第十五届校赛 G-Cylinder Candy

Cylinder Candy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Edward the confectioner is making a new batch of chocolate covered candy. Each candy center is shaped as a cylinder with radius r mm and height h mm. The candy center

Cylinder Candy(积分)

Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is making a new batch of chocolate covered candy. Each candy center is shaped as a cylinder with radius r mm and height h mm. The candy center needs to