Advertisement
juanjo12x

UVA_11723_Numbering_Road

Aug 9th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <string>
  6. #include <cctype>
  7. #include <stack>
  8. #include <queue>
  9. #include <list>
  10. #include <vector>
  11. #include <map>
  12. #include <set>
  13. #include <sstream>
  14. #include <stdlib.h>
  15. #include <cmath>
  16. #define LL unsigned long long
  17. using namespace std;
  18.  
  19. int main() {
  20.      int n,r;
  21.      int test=0;
  22.     while(scanf("%d %d",&r,&n)){
  23.         test++;
  24.         if(n==0 && r==0) break;
  25.         if(r<=n){
  26.             printf("Case %d: 0\n",test);
  27.         }else{
  28.             if(27*n<r){
  29.                 printf("Case %d: impossible\n",test);
  30.             }else{
  31.              int d=r/n;
  32.              if(r%n==0) d--;
  33.                 printf("Case %d: %d\n",test,d);
  34.             }
  35.         }
  36.            
  37.     }
  38.     return 0;
  39.        
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement