2023112626_duqunyao @ 2023-09-11 14:41:28
#include <stdio.h>
int main()
{
int n,k;
int A=0;
int B=0;
int a=0;
int b=0;
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)
{
if(i%k==0) {a+=i;A+=1;}
else {b+=i;B+=1;}
}
double a_=a/A*1.0;
double b_=b/B*1.0;
printf("%.1f",a_);
printf(" %.1f",b_);
return 0;
}
只有1,5AC,2-4WA是为什么?
by IOI_AK_TLR @ 2023-09-11 14:46:15
变量a_和b_赋值时先1.0再a/A
by 2023112626_duqunyao @ 2023-09-11 22:46:54
@IOI_AK_TLR 谢谢谢谢,终于过了!