Skip to content

Instantly share code, notes, and snippets.

@javascripter
Created October 4, 2014 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javascripter/b82da7318364a04ec31d to your computer and use it in GitHub Desktop.
Save javascripter/b82da7318364a04ec31d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(void) {
int n;
int employees[4000] = {0};
while (1) {
scanf("%d", &n);
if (!n) break;
for (int i = 0; i < n; i++) {
int id, price, sales;
scanf("%d %d %d\n", &id, &price, &sales);
employees[id] += price * sales;
}
int found = 0;
for (int i = 0; i < 4000; i++) {
if (employees[i] >= 1000000) {
printf("%d\n", i);
found = 1;
}
}
memset(employees, 0, sizeof employees);
if (!found) {
printf("NA\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment