Wc_king @ 2024-11-29 14:13:21
for(int i=1;i<=n;i++){ if(i%k==0){ count++; int arr[]=new int[count]; for(int j=count-1;j<count;j++){ arr[j]=i; sum+=arr[j]; } }else{ temp++; int arr1[]=new int[temp]; for(int j=temp-1;j<temp;j++){ arr1[j]=i; sum1+=arr1[j];
}
}
}
float average = (sum/(count*1.0f));
float average1= (sum1/(temp*1.0f));
float g= (float) (Math.floor(average*10)/10.0);
float j= (float) (Math.floor(average1*10)/10.0);
System.out.println(g+" "+j);
}
}
by dg114514 @ 2024-11-29 14:37:45
希望更丰富的展现?使用
by zhanran2014 @ 2024-12-08 15:51:32
希望更丰富的展现?阅读 Markdown 使用帮助、KaTeX 文档。@dg114514
by dg114514 @ 2024-12-08 15:58:52
@zhanran2014这里只需要用
by zhanran2014 @ 2024-12-10 20:01:20
@dg114514 OK