immuntasir

11608

Feb 14th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. int main() {
  3.     int tc=1;
  4.     while(1) {
  5.         int total;
  6.         scanf("%d",&total);
  7.        
  8.         if (total < 0) {
  9.             break;
  10.         }
  11.        
  12.         printf("Case %d:\n",tc);
  13.         int c[12],nn[12];
  14.  
  15.         int i;
  16.         for (i=0;i<12;i++) {
  17.             scanf("%d", &nn[i]);
  18.         }
  19.         for (i=0;i<12;i++) {
  20.             scanf("%d", &c[i]);
  21.         }
  22.  
  23.         for (i=0;i<12;i++) {
  24.             if (c[i] <= total) {
  25.                 printf("No problem! :D\n");
  26.                 tc++;
  27.                 total = total - c[i] + nn[i];
  28.             }
  29.  
  30.             else {
  31.                 printf("No problem. :(\n");
  32.                 tc++;
  33.                 total = total+nn[i];
  34.             }
  35.         }
  36.         tc++;
  37.     }
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment