Pet
Author: Pakin Olanraktham
เฉลย
#include <stdio.h>
int main() {
int a = 0, b;
for (int i = 0; i < 5; i++) {
int w, x, y, z;
scanf("%d %d %d %d", &w, &x, &y, &z);
if (a < w+x+y+z) {
a = w+x+y+z;
b = i+1;
}
}
printf("%d %d", b, a);
}
#include <iostream>
using namespace std;
int main() {
int a = 0, b;
for (int i = 0; i < 5; i++) {
int w, x, y, z;
cin >> w >> x >> y >> z;
if (a < w+x+y+z) {
a = w+x+y+z;
b = i+1;
}
}
cout << b << " " << a;
}