power_man @ 2022-07-16 15:24:05
xdm我复制题解对照了下,感觉没啥区别但#2#3#4报错,有没有神犇解答一下,谢谢
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
int a,b,c=0,d=0;
double c1=0,d1=0;
cin>>a>>b;
for(int i=b;i<=a;i+=b){
c+=i;
}
d=(1+a)*a/2-c;
printf("%.1lf %.1lf",(double)(c/(a/b)),(double)(d/(a-a/b)));
return 0;
}
by bamboo12345 @ 2022-07-16 15:29:00
@power_man 要先取double再去除
by power_man @ 2022-07-16 15:32:59
@bamboo123 谢谢大佬