ONicklgzh @ 2023-11-11 23:28:49
#include <stdio.h>
int main(){
int n,i;
double eff1,eff2;
double a[50],b[50];
scanf("%d",&n);
scanf("%lf %lf",&a[1],&b[1]);
for(i=2;i<=n;i++){
scanf("%lf %lf\n",&a[i],&b[i]);
eff1=100*b[1]/a[1];
eff2=100*b[i]/a[i];
if(eff2-eff1>=5){
printf("better");}
else if(eff1-eff2>=5){
printf("worse");}
else {
printf("same");}
}
return 0;
}
by H2ptimize @ 2023-11-11 23:47:23
@ONicklgzh 换行
by ONicklgzh @ 2023-11-11 23:52:54
@dpy_dog 对了 谢谢
by kelibzd @ 2023-11-19 00:02:54
@ONicklgzh 为啥还是不行啊,楼主
by kelibzd @ 2023-11-19 00:04:02
#include<stdio.h>
int main()
{
double s1,s2,a[20],b[20],n;int i;
scanf("%d\n",&n);
scanf("%lf %lf\n",&a[1],&b[1]);
s1=100*a[1]/b[1];
for(i=2;i<=n;i++)
{
scanf("%lf %lf\n",&a[i],&b[i]);
s2=100*a[i]/b[i];
if(s2-s1>5)
printf("better\n");
else if(s1-s2>5)
printf("worse\n");
else
printf("same");
}
return 0;
}