1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| #include <stdio.h> float max(float d1, float d2, float d3); int main() { int n; scanf("%d", &n); float best_overall_score = 0.0; int best_player_id = 0; for (int i = 1; i <= n; i++) { float s1, s2, s3; scanf("%f %f %f", &s1, &s2, &s3); float current_best = max(s1, s2, s3); if (current_best > best_overall_score) { best_overall_score = current_best; best_player_id = i; } }
printf("%d %.2f\n", best_player_id, best_overall_score);
return 0; }
float max(float d1, float d2, float d3) { float temp_max = d1;
if (d2 > temp_max) { temp_max = d2; } if (d3 > temp_max) { temp_max = d3; }
return temp_max; }
|