Thursday, July 17, 2014

UVa - 11723 - Numbering Roads

#include <iostream>
using namespace std;

int main(){
    int n , r, ans, cs = 1;
    while(cin >> n >> r){
        if(n == 0 && r == 0)break;
        ans = n/r;
        if(ans <= 26){
            if(n%r == 0)ans--;
            if(n <= r)ans = 0;
            cout << "Case " << cs << ": " << ans << endl;
        }
        else cout << "Case " << cs << ": " << "impossible" << endl;cs++;
    }
    return 0;
}

No comments:

Post a Comment