刷题笔记26.10.27
发布时间:2026/11/4 2:26:46 锦皓数字建站

#includestdio.h int main(){ float t; int n; scanf(%f%d,t,n); float c t/n; int d 2*n; printf(%.3f\n,c); printf(%d,d); }没有强调正整数的情况下要注意要不要使用浮点数浮点数的精度控制%.nf n是几小数点就可以精确到几输入时无需添加我的答案#includestdio.h int main(){ int m; int t; int s; scanf(%d%d%d,m,t,s); int c s/t; int e m-c; int f e-1; if(s%t0){ printf(%d,e); }else{ printf(%d,f); } }标准答案#include stdio.h int main() { int m, t, s; scanf(%d %d %d, m, t, s); if (t 0) { printf(0\n); return 0; } int left m - s / t; if (s % t ! 0) { left--; } if (left 0) { left 0; } printf(%d\n, left); }要考虑问题的全面性
锦
锦皓数字建站
深耕本土企业品牌数字化升级,专注原创端正雅致商务官网,从视觉设计到稳定运维全程保驾护航。