W__D__Gaster_ @ 2022-09-30 12:06:52
#include <iostream>
#include <iomanip>
using namespace std;
float e, c;
int main() {
int n, k, sum1 = 0, sum2 = 0;
cin >> n >> k;
for (int i = 1; i <= n; i++) {
if (i % k == 0) {
e += i;
sum1++;
} else {
c += i;
sum2++;
}
cout << e << " " << c << endl << endl;
}
e /= sum1 * 1.0;
c /= sum2 * 1.0;
printf("%.1f\n", e);
printf("%.1f\n", c);
return 0;
}
by W__D__Gaster_ @ 2022-09-30 12:16:34
#include <iostream>
#include <iomanip>
using namespace std;
double e, c;
int main() {
int n, k, sum1 = 0, sum2 = 0;
cin >> n >> k;
for (int i = 1; i <= n; i++) {
}
for (int i = 1; i <= n; i++) {
if (i % k == 0) {
e += i;
sum1++;
} else {
c += i;
sum2++;
}
}
e = e / sum1;
c = c / sum2;
printf("%.1f", e);
cout << " ";
printf("%.1f", c);
return 0;
}
by zhang_kevin @ 2022-09-30 12:35:59
wyy?
by liangbowen @ 2022-09-30 12:41:39
@zhang_kevin 应该不算,只是btd+表述极其不清 而已((
by Iwara_qwq @ 2022-09-30 13:24:37