0100 - Sale Result
#include <iostream> #include <map> #include <vector> using namespace std; void Slove(int n) { int number; long long price, sale; vector<int> number_data; map<int,long long> money_data; number_data.clear(); money_data.clear(); for (int i=0; i<n; ++i) { cin >> number >> price >> sale; if (!money_data[number]) number_data.push_back(number); money_data[number]+=price*sale; } bool flg=false; for (int i=0; i<number_data.size(); ++i) if (money_data[ number_data[i] ] >= 1000000) { flg=true; cout << number_data[i] << endl; } if (!flg) cout << "NA" << endl; } int main(void) { int n; while (cin >> n && n) Slove(n); return 0; }
"""入力された順番に"""という単語を見逃してて3WA...orz