Saturday, October 22, 2016

UVA 11723 - Numbering Roads

#include<bits/stdc++.h>
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
   int r , n , kase = 0;
   while(cin >> r >> n &&r &&n){
    bool flg = false;
    for (int i = 1; i <= 27; ++i)
    {
        if(i*n >= r){
            cout << "Case "<<++kase<<": "<<i-1<<'\n';
            flg = true;
            break;
        }
    }
    if(!flg)cout << "Case "<<++kase<<": impossible\n";
   }

return 0;
}

No comments:

Post a Comment