_technoblade_ @ 2022-11-18 21:28:56
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,k,i,cnt1,cnt2,p,o,s;
double c1,c2;
cin>>n>>k;
s=cnt1=cnt2=p=o=0;
for(i=1;i<=n;i++)
{
if(i%k==0){c1+=i;cnt1++;}
else {c2+=i;cnt2++;}
}
p=c1*1.0/cnt1;
o=c2*1.0/cnt2;
printf("%.1f",p);
cout<<" ";
printf("%.1f",o);
return 0;
}
by SmallBlack @ 2022-11-18 21:32:41
请注意你的p和o是long long类型的