- 558 名前:デフォルトの名無しさん mailto:sage [2009/03/31(火) 12:18:18 ]
- >>546
#include<stdio.h> #include<math.h> typedef struct tag_info_t{ long i; double h, w; }info_t; double get_bmi(double h, double w){ return w/(h*h); } int main(void){ long i, n; double bmi, best_bmi; info_t x, best; for(;;){ if(scanf("%ld", &n)!=1 || n<1) break; for(i=0;i<n;i++){ scanf("%ld %lf %lf", &x.i, &x.h, &x.w); bmi=get_bmi(x.h/100., x.w); if(i==0 || fabs(best_bmi-22)>fabs(bmi-22)){ best=x; best_bmi=bmi; } } printf("%ld\n", best.i); } return 0; }
|

|