1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#include <iostream> #include <cstdio> //#include <fstream> using namespace std; //ofstream out; int main() { int kase=1; int arr[15]; int init_problem_num; int total_problem[15]; int problem_required[15]; //out.open("out.txt"); while(scanf("%d",&init_problem_num)) { if(init_problem_num<0) break; total_problem[0]=init_problem_num; for(int i=0;i<12;i++) { scanf("%d",&arr[i]); if(i>0) total_problem[i]=total_problem[i-1]+arr[i-1]; } for(int i=0;i<12;i++) scanf("%d",&problem_required[i]); printf("Case %d:\n",kase); //out<<"Case "<<kase<<":\n"; kase+=1; int problem_used=0; for(int i=0;i<12;i++) { if(problem_required[i]<=(total_problem[i]-problem_used)) { printf("No problem! :D\n"); //out<<"No problem! :D\n"; problem_used += problem_required[i]; } else { printf("No problem. :(\n"); //out<<"No problem. :(\n"; } } } return 0; } |