SDFZ_SHH @ 2023-10-14 15:00:46
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k, q, w, e, r;
double a, b;
cin >> n >> k;
for (int i = 1; i >= n; i++)
{
if (i % k == 0)
{
cout << i << endl;
q += i;
cout << q << endl;
e++;
cout << e << endl;
}
else
{
w += i;
cout << w << endl;
r++;
cout << r << endl;
}
}
a = q / e;
cout << a << endl;
b = w / r;
cout << b << endl;
printf("%.1lf %.1lf",a,b);
return 0;
}
by Miracle_1024 @ 2023-10-14 15:23:18
@SHH_WTF 你样例都没过,而且为什么输出了两遍,一个cout一个printf
by Miracle_1024 @ 2023-10-14 15:23:57
输出只有两个数,你前面那么多cout是啥意思
by Miracle_1024 @ 2023-10-14 15:24:30
你这思路完全不对啊
by SDFZ_SHH @ 2023-10-14 19:18:50
@SunArrebol 这是我Debug的时候忘删了
by SDFZ_SHH @ 2023-10-14 19:20:10
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k, q, w, e, r;
double a, b;
cin >> n >> k;
for (int i = 1; i >= n; i++)
{
if (i % k == 0)
{
q += i;
e++;
}
else
{
w += i;
r++;
}
}
a = q / e;
b = w / r;
printf("%.1lf %.1lf",a,b);
return 0;
}
by _xingjing_ @ 2023-10-16 12:56:20
没实力
by XYM20230422 @ 2024-09-11 13:49:33
没实力