Advertisement
nontawat1996

hotel

Oct 8th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n,sum=0;
  7.     scanf("%d",&n);
  8.     sum=(n/15)*3000;
  9.     n%=15;
  10.  
  11.     if(n>10) sum+=3000;
  12.     else
  13.     {
  14.         sum+=(n/5)*1500;
  15.         n%=5;
  16.         if(n>3) sum+=1500;
  17.         else
  18.         {
  19.             sum+=(n/2)*800;
  20.             n%=2;
  21.             sum+=n*500;
  22.         }
  23.     }
  24.  
  25.     printf("%d",sum);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement