AcWing 661. 平均数3
原题链接
中等
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+1e4;
double a,b,c,d,y;//a,b,c,d为初始的四个数 ,y为输出Aluno em exame后的数字y
double pjz;//平均值(pjz)
signed main()
{
cin>>a>>b>>c>>d;
pjz=(a*2.0)+(b*3.0)+(c*4.0)+(d);
pjz/=10.0;
ll k=round(pjz*100);//记得必须用round来四舍五入
if(k%10==5)pjz+=0.1;
printf("Media: %.1lf\n",pjz);
if(pjz>=7.0)cout<<"Aluno aprovado.";
else if(pjz>=5.0)
{
cout<<"Aluno em exame."<<"\n";
cin>>y;
printf("Nota do exame: %.1f\n",y);
pjz=(pjz+y)/2;
if(pjz>=5)cout<<"Aluno aprovado.\n";
else cout<<"Aluno reprovado.\n";
printf("Media final: %.1f\n",pjz);
}
else cout<<"Aluno reprovado.";
return 0;
}
谢谢大佬
为啥要*100呀
移位
无法AC
?我看看
好了,改好了
ok ,速度! hh
其实调了20+分钟了,一开始想着*100再求余,结果错了QWQ