yangzhouhan @ 2022-03-08 22:04:25
(请点这里)
by Jasper08 @ 2022-03-08 22:06:25
@yangzhouhan
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
bool cmp (int a, int b)
{
return a > b;
}
int main()
{
int n = 0, k = 0;
cin >> n >> k;
double aver1 = 0, aver2 = 0;
int i = k;
for (; i <= n; i += k)
{
aver1 += i;
}
i = i / k - 1;
aver1 /= i;
for (int j = 1; j <= n; j++)
{
aver2 += j;
}
aver2 -= aver1 * i;
aver2 /= (n - i);
printf("%.1f %.1f", (double)(aver1), (double)(aver2));
return 0;
}
by SSqwq_ @ 2022-03-08 22:15:51
@yangzhouhan 你一个
for(int q=n;q<=n;q--)你都不觉着有问题?再说这是死循环吧,这都看不出来?