#include<stdio.h> int main() { int ti=0,zhan,neng,M,N,X,count; scanf("%d%d%d",&M,&zhan,&neng); while(1) // >0 而不能是>=0 { if(neng-ceil(M/zhan)>0) { neng=neng-ceil((double)M/(double)zhan); zhan=zhan+M/zhan; } else break; } printf("%d ",zhan); return 0; }
neng=neng-ceil((double)M/(double)zhan); //测试纠错代码,因为错代码被提示超时,所以人工复制粘贴输出测试调试 count=M/zhan; printf("%d %d %d \n",ti,zhan,neng); //ti=0; zhan=zhan+count;
```c #include<stdio.h> int main() { int ti=0,zhan,neng,M,N,X,count; scanf("%d%d%d",&M,&zhan,&neng); while(neng-ceil(M/zhan)>0) // >0 而不能是>=0 { neng=neng-ceil((double)M/(double)zhan); zhan=zhan+M/zhan; } printf("%d ",zhan); return 0; } ```
塞卜哈 2024-04-22 10:48:13 |
合并scanf