UVa : 11723 (Numbering Roads!)


// http://uva.onlinejudge.org/external/117/11723.html

// @BEGIN_OF_SOURCE_CODE

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#define pi acos(-1.0)
#define N 1000000
using namespace std;


int main ()
{
    int n, r;
    int cases = 0;

    while ( scanf ("%d %d", &r, &n) ) {
        if ( r == 0 && n == 0 ) break;

        bool printed = false;

        for ( int i = 1; i <= 27; i++ ) {
            if ( n * i >= r ) {
                printf ("Case %d: %d\n", ++cases, i - 1);
                printed = true;
                break;
            }
        }

        if ( !printed )
            printf ("Case %d: impossible\n", ++cases);
    }

    return 0;
}

// @END_OF_SOURCE_CODE

One thought on “UVa : 11723 (Numbering Roads!)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s