Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- int main()
- {
- int i, employee, customers;
- scanf("%d", &employee);
- scanf("%d", &customers);
- int timeByEmployee[employee];
- int itemsByCustomers[customers];
- //Preencher a Lista com os nomes
- for(i = 0; i < employee; i++)
- scanf("%d", &timeByEmployee[i]);
- for(i = 0; i < customers; i++)
- scanf("%d", &itemsByCustomers[i]);
- int tempoGasto[employee];
- int t =0;
- while(t < customers){
- if(t < employee){
- tempoGasto[t] = itemsByCustomers[t] * timeByEmployee[t];
- t++;
- }
- else{
- int index = tempoGasto[0];
- int z = 0;
- for(i = 0; i < employee; i++)
- if(index > tempoGasto[i])
- {
- index = tempoGasto[i];
- z = i;
- }
- tempoGasto[z] += itemsByCustomers[t] * timeByEmployee[z];
- z = 0;
- t++;
- }
- }
- int index = tempoGasto[0];
- for(i=0; i < employee; i++){
- printf("%d ",tempoGasto[i]);
- }
- for(i = 0; i < employee; i++)
- if(index < tempoGasto[i])
- index = tempoGasto[i];
- printf("\n%d\n", index);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement