Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- FILE *infile;
- int n,i,time,price,totPrice=0;
- infile=fopen("input.txt","r");
- if (infile==NULL) exit (1);
- fscanf(infile,"%d",&n);
- for(i=0;i<n;i++)
- {
- fscanf(infile,"%d",&time);
- if(time<=120)
- price=100;
- else
- price=100 + 5*(ceil((time-120)/10.0));
- totPrice+=price;
- }
- printf("%d\n",totPrice);
- fclose(infile);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement