#include #include #include #include #include #include #include #include #include #include #include using namespace std; class MyCalendar { public: MyCalendar(); bool book(int start, int end); }; MyCalendar::MyCalendar() {} bool MyCalendar::book(int start, int end) { (void) start; (void) end; return true; } int main() { MyCalendar m; int start, end; bool rv, p; string word; istringstream ss; int seed, num; int nt, nf, i; while (ss >> word) { if (word == "BOOK") { if (!(cin >> start >> end)) exit(0); printf("%s\n", (m.book(start, end)) ? "TRUE" : "FALSE"); } else if (word == "RAND" || word == "RAND-P") { p = word[word.size()-1] == 'P'; if (!(cin >> seed >> num)) exit(0); srand48(seed); nt = 0; nf = 0; for (i = 0; i < num; i++) { start = drand48() * 1000000000; end = start + drand48() * 10000000 + 1; rv = m.book(start, end); if (rv) { nt++; } else { nf++; } if (p) printf("%d %d %s\n", start, end, (rv) ? "TRUE" : "FALSE"); } printf("%d %d\n", nt, nf); } else { printf("Commands must be BOOK, RAND or RAND-P\n"); exit(1); } } return 0; }