Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////
- #include <iostream>
- #include <thread>
- #include <mutex>
- #include <string>
- using namespace std;
- std::mutex g_pages_mutex;
- FILE *stream;
- void MAIN() {
- g_pages_mutex.lock();
- //freopen_s(&stream, "B-large1.in", "r", stdin);
- //freopen_s(&stream, "B-large1.out", "w", stdout);
- int T;
- cin >> T;
- for (int i = 0; i < T; ++i) {
- unsigned long long A, B, K;
- cin >> A >> B >> K;
- unsigned long long sum = 0;
- for (unsigned long long j = 0; j < A; ++j)
- for (unsigned long long k = 0; k < B; ++k) {
- if ((j & k) < K) { ++sum; }
- }
- cout << "Case #" << i + 1 << ": " << sum << endl;
- }
- g_pages_mutex.unlock();
- }
- int main() {
- thread t1(MAIN);
- thread t2(MAIN);
- thread t3(MAIN);
- t1.join();
- t2.join();
- t3.join();
- g_pages_mutex.unlock();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement