#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define ERROR 1e-11
using namespace std;
typedef double dt;
dt min(dt a, dt b)
{
return (a<b?a:b);
}
int main()
{
dt s, b, nx_pro, pr_pro;
int kase=1;
while (cin >> b >> s)
{
if (fabs(b-0.00)<ERROR && fabs(s-0.00)<ERROR) break;
cout << "Case " << kase++ << ": ";
pr_pro = min(s/b,(dt)1);
if (b==1.00)
{
cout << ":-\\" << endl;
continue;
}
nx_pro = min((s-(dt)1)/(b-(dt)1),(dt)1);
if (nx_pro>pr_pro) cout << ":-)" << endl;
else if (nx_pro<pr_pro) cout << ":-(" << endl;
else cout << ":-|" << endl;
}
return 0;
}
Thursday, November 10, 2011
[UVa] 12114 - Bachelor Arithmetic
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Method: The problem at first glance seems too straightforward but it's not that much. Think a bit about the lines "Erin can add ...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.