Untitled

mail@pastecode.io avatar
unknown
c_cpp
22 days ago
677 B
0
Indexable
Never
#include <iostream>
using namespace std;

int main() {
    int golemina;
    cin >> golemina;

    int zelka[golemina];
    int morkov[golemina];

    for(int i = 0; i < golemina; i += 1) {
        cin >> zelka[i];
        cin >> morkov[i];
    }
    int zbir_zelki = 0;
    for(int i = 0; i < golemina; i += 1) {
        zbir_zelki += zelka[i];
    }
    int zbir_morkovi = 0;
    for(int i = 0; i < golemina; i += 1) {
        zbir_morkovi += morkov[i];
    }
    if(zbir_zelki > zbir_morkovi) {
        cout << "zelka" << endl;
        cout << zbir_zelki << endl;
    }
    else {
        cout << "morkov" << endl;
        cout << zbir_morkovi << endl;
    }
    return 0;
}
Leave a Comment