#include<stdio.h> int main() { double a,b,c; int d; scanf("%1f %d",&a,&b); if(a<=3){ c=10; }else{ if(a<=10){ c=10+(a-3)*2; }else { c=24+(a-10)*3; } } d=b/5*2; printf("%.0f",c+d); return 0; }
当a大于3之后进不了后面的else
收起
scanf() 的格式要注意。
double 类型要用 lf, 注意, 不是 1f
scanf("%lf %lf", &a, &b);
报告相同问题?