题目:http://acm.hdu.edu.cn/showproblem.php?pid=2002 注意,要用double 才能过,float过不了. 体积公式要加括号(优先级别)(4 * Π * r * r * r)/3 #include <stdio.h> #define PI 3.1415927 int main() { double r, v; while(~scanf("%lf", &r)) { v = (4 * PI * r * r * r)/3; pr
Description Your new company is building a robot that can hold small lightweight objects. The robot will have the intelligence to determine if an object is light enough to hold. It does this by taking pictures of the object from the 6 cardinal dire
import java.util.Scanner; class Test { public static void main(String[] args) { fangfa i = new fangfa(); Cylinder s1 = new Cylinder(); Cylinder s2 = new Cylinder(); Cylinder s3 = new Cylinder(); System.out.print("容积:"); i.shixian(s1, 5.0, 6.0);
球冠公式是\(\frac{\pi h^2(3R-h)}{3}\),这样再余弦公式用\(R_a\)和\(R_b\)导一导两个球冠的\(h\)就做完了.算是补了个camp时没做出来的小坑了. #include <bits/stdc++.h> using namespace std; typedef double db; const db eps = 1e-8; const db PI = acos(-1.0); int dcmp(db x) { if (fabs(x) < eps) retu