1 条题解
-
0
C :
#include<stdio.h> void main() { int m,n,h,i=1; scanf("%d%d%d",&m,&n,&h); while(h>0){ h-=m; if(h>0){ i++; h+=n; }else{ break; } } printf("%d",i); }
C++ :
#include<iostream> using namespace std; int main(){ int m,n,h,i,j; cin>>m>>n>>h; i=0; j=0; while(true){ i=i+m; j++; if(i>=h){ break; } i=i-n; } cout<<j<<endl; }
Python :
m, n, h = map(int,input().split()); d = 1 s = 0 while s <= h: s = d*(m-n) if s < (h-m): d += 1 elif s >= (h-m): print(d+1) break;
- 1
信息
- ID
- 110
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 7
- 标签
- 递交数
- 14
- 已通过
- 12
- 上传者