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 35 | #include <iostream> using namespace std; int N[9]; int i, k; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); for (i = 0; i < 9; i++) { while (1) { cin >> N[i]; if (1 <= N[i] && N[i] <= 100) break; } } int max = N[0]; for (int j = 0; j < 9; j++) { if (max < N[j]) max = N[j]; } for (k = 0; k < 9; k++) { if (max == N[k]) break; } cout << max << ‘\n’; cout << k + 1 << ‘\n’; return 0; } | cs |