这是哪里错了啊?
查看原帖
这是哪里错了啊?
1328081
huangkezhen楼主2024/6/2 20:00
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >> k;
	double a=0,b=0,c=0,d=0,e,f;
	for(int i=1;i<=n;i++){
		if(n%k==0){
			a=a+i;
			c++;
		}
		else{
			b=b+i;
			d++;
		}
	} 
	e=a/c;
	f=b/d;
	cout << fixed << setprecision(1) << e << f;
}
2024/6/2 20:00
加载中...