wang0728 @ 2022-12-10 20:49:08
#include <cstdio>
using namespace std;
double sum,c,a,b;
int main()
{
int n,k;
scanf("%d%d",&n,&k);
for(int i=1;i<n;i++)
{
if(i%k==0)
{
sum=sum+i;
a++;
}
else
{
c=c+i;
b++;
}
}
printf("%.1f %.1f",sum/a,c/b);
return 0;
}
by Katz @ 2022-12-10 20:54:40
for(int i=1;i<n;i++)
少打了个=
by Katz @ 2022-12-10 20:55:16
下次提交以前记得一定要测试样例
by HopesandDreams @ 2022-12-10 20:59:04
@PMAC 根据省实的公众号,我有可能可以发现您的照片
by Katz @ 2022-12-10 21:00:05
@114514YC 我们校长要给我做推文,不远了
但是我好像爆过照的说(
by zfw100 @ 2022-12-19 13:13:49
#include<bits/stdc++.h>
using namespace std
int main(){
int n,k;
double a=0,b=0,p=0,q=0;
cin>>n>>k;
for(int i=1;i<=n;i++){
if(i%k==0){
p=p+i;
a++;
}else{
q=q+i;
b++;
}
}
cout<<fixed<<setprecision(1)<<p/a/1.0<<" "<<q/b/1.0;
}
by wang0728 @ 2023-01-06 15:55:10
@PMAC 好的,我改一下