P3954 [NOIP2017 普及组] 成绩 (c语言)

P3954 [NOIP2017 普及组] 成绩

@[Senpai](/user/821998) ```c #include <bits/stdc++.h> using namespace std; void in(int &x){ char c=getchar(); while (c<'0' || c>'9') c=getchar(); for (x=0; c>='0' && c<='9'; c=getchar()) x=x*10+c-'0'; } int main (){ float a,b,c; scanf ("%f %f %f",&a,&b,&c); float p=a*0.2+b*0.3+c*0.5; printf ("%.0f",p); return 0; } ``` 貌似是可以的
by fwhzqr @ 2022-10-05 21:45:22


貌似快一点 ```c #include <stdlib.h> #include <stdio.h> int main() { int a,b,c,d; scanf("%d%d%d",&a,&b,&c); d=0.2*a+0.3*b+0.5*c; printf("%d",d); system ("pause"); return 0; } ```
by Yanb0 @ 2022-10-05 21:56:44


算了,我还是有待提高
by Yanb0 @ 2022-10-05 21:57:18


```cpp #include<bits/stdc++.h> #include <cmath> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; cout<<a*0.2+b*0.3+c*0.5; return 0 ; } ``` 貌似这样更简单(我是蒟蒻,勿喷勿喷)
by yuwuyanqiu @ 2023-06-08 21:02:15


@[Yanb0](/user/821998) 因为这道题的答案是int类型。 C++ AC Code: ```cpp #include<bits/stdc++.h> using namespace std; int a,b,c; int main(){ scanf("%d%d%d",&a,&b,&c); printf("%d",a*20/100+b*30/100+c*50/100); exit(0); } ``` 代码长度:157B; 用时:30ms; 内存:736.00KB。
by _ant_ant @ 2023-08-03 10:07:41


``` #include<iostream> using namespace std; int main() { long long a,b,c; cin>>a>>b>>c; cout<<a*0.2+b*0.3+c*0.5; } ``` 或许这样就好了【狗头】
by sanmu_kangping @ 2023-08-13 21:20:23


|