0分求助
查看原帖
0分求助
368731
lake_tree楼主2021/9/15 20:13
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c1;
	cin>>a>>b;
	float c=0,d=0;
	for(int i=1;i<=a;i++){
		if(i%b==0){
			c+=i;
			c1++;
		}else if(i%b!=0){
			d+=i;
		} 
	}
	cout<<fixed<<setprecision(1)<<(float)c/c1<<" ";
	cout<<fixed<<setprecision(1)<<(float)d/(a-c1);
    return 0;
}
2021/9/15 20:13
加载中...