题解 | #牛牛的短信#
牛牛的短信
https://www.nowcoder.com/practice/435c9e2bf4f84bee99b82ce84e95b0b7
#include <stdio.h>
void judge(int m,double* cost)
{
if(m<=60)
{
*cost+=0.1;
}
else
{
*cost+=0.2;
}
}
int main()
{
int n;
double cost=0;
scanf("%d",&n);
while(n)
{
int m;
scanf("%d",&m);
judge(m,&cost);
n--;
}
printf("%lf",cost);
return 0;
}

查看14道真题和解析