题解 2771: 大象喝水

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

主要是要解决向上取整的问题

```pythonh,r=map(int,input().split())Pi=3.14159#毫升mL=Pi*r*r*h#升L=mL/1000#桶数num=20/L#桶数向上取整ifnum-int(num)==0:#如2.0->2print(int(num))else:#如2.1->3print(i

2771: 大象喝水 通俗易懂

摘要:解题思路:注意事项:eg 20/19 结果为1,但是实际上大象要喝两桶。所以分两种情况 20/V==0 或20/V!=0。都是成功提交过的,……

2025.7.21刷题记录

摘要:解题思路:注意事项:参考代码:#include<stdio.h>const double pi = 3.14159;int main(){ //大象要喝的水量&n……

C++简单解法

解题思路:此题属于简单题,需要知道向上取整的函数ceil(),其他的都是基础知识注意事项:参考代码:#include#include#definepi3.14159usingnamespacestd;intmain(void){inth,

大象喝水题解,,,,

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){    int h,r,t;    double v;    scanf("%d %d",&h,&r);    ……

三行秒杀大象喝水

解题思路:map函数接收输入注意事项:至少喝几桶水用向上取整参考代码:importmathh,r=map(int,input().split())print(math.ceil(20000/(h*math.pi*r*r)))

2771: 大象喝水(简单)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#define PI 3.14159int main(){    int r,h;    double sum=0,num=0;    ……