From b300254ee1f308c440d8e8d8129fb863b6ec9599 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 30 Dec 2012 16:05:36 +0330 Subject: Making the legacy more useful Added a brief installation guide in README along with etc config file samples. Added a couple of useful start and kill scripts in utils folder. Added two sample problems (one normal one interactive) along with testers in utils folder. --- problems/bs/bs.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 problems/bs/bs.cpp (limited to 'problems/bs/bs.cpp') diff --git a/problems/bs/bs.cpp b/problems/bs/bs.cpp new file mode 100644 index 0000000..37600e6 --- /dev/null +++ b/problems/bs/bs.cpp @@ -0,0 +1,28 @@ +#include + +using namespace std; + +int main() +{ + //cerr << "chert" << endl; + long long max; cin >> max; + + long long s = 0, e = max + 1; + + while (e - s > 1) + { + long long m = (e + s) / 2; + cout << m << endl; + string res; + cin >> res; + //cerr << "responce to " << m << " is " << res << endl; + if (res == "correct") + break; + else if (res == "high") + e = m; + else + s = m; + } + + return 0; +} -- cgit