AOJ 0239 Calorie Counting

問題文

Calorie Counting

感想

絶望的に条件を拾いづらくしており悪質。

解法

読んだらあとは実装すると通る。

ソース

実装下手

#include <iostream>
#include <cstdio>
using namespace std;
 
int II[1000] , PP[1000] , QQ[1000] , RR[1000];
int main(){
    int n;
    while(cin >> n && n){
        int x = 0;
        for(int i = 0 ; i < n ; i++){
            cin >> II[i] >> PP[i] >> QQ[i] >> RR[i];
        }
        int P,Q,R,C,k=0;
        cin >> P >> Q >> R >> C;
        for(int i = 0 ; i < n ; i++){
            if(PP[i] <= P && QQ[i] <= Q && RR[i] <= R && PP[i] * 4 + RR[i] * 4 + QQ[i] * 9 <= C){
                cout << II[i] << endl;
                k++;
            }
        }
        if(!k) cout << "NA" << endl;
    }
}