Cymbid @ 2020-03-15 09:05:49
为什么只有40分啊。。。
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int a[10000],b[10000]={};
int n,k,numa,numb=0;
float totala,totalb=0;
cin>>n>>k;
for(int i=1;i<=n;i++)i%k==0?a[numa++]=i:b[numb++]=i;
for(int i=0;i<numa;i++)totala+=a[i];
for(int i=0;i<numb;i++)totalb+=b[i];
printf("%.1f %.1f",totala/numa,totalb/numb;
return 0;
}
by OItby @ 2020-03-15 09:06:09
额,蔡徐坤
by shao_qian @ 2020-03-15 09:11:29
???你printf的)
呢?
by shao_qian @ 2020-03-15 09:12:36
int/int当然是int
int * 1.0/int
by tangrunxi @ 2020-03-15 09:14:35
@韶浅 如果没写右括号应该会CE啊
by shao_qian @ 2020-03-15 09:14:37
@_蔡徐坤 printf("%.1f %.1f",totala*1.0/numa,totalb*1.0/numb);
by lowAltitudeFlyer @ 2020-03-15 09:14:52
用户名好评(
by Cymbid @ 2020-03-15 09:22:18
printf的右括号本来是有的,写在这里时不小心漏粘了
by Cymbid @ 2020-03-15 09:24:48
*1.0 的做法没用的 还是40分
totala 和 totalb 不是float类型吗
by 血色黄昏 @ 2020-03-15 09:45:07
名字好评
by VincentXu @ 2020-03-15 09:50:39
为什么不去问问篮球