题解 | #牛牛的水杯#
牛牛的水杯
https://www.nowcoder.com/practice/c196c47c23394bf3bdd4f82a838df6bf
解题思路
没啥好说的
代码实现
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double h = sc.nextDouble(); //半径 double r = sc.nextDouble(); double v; int cup; v = 3.14*h*r*r; cup = (int)(10000/v); if(10000%v == 0){ System.out.printf("%d",cup); } else{ System.out.printf("%d",cup+1); } } }