Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ctime>
- #include <iostream>
- int main() {
- int x, d;
- std::cin >> x >> d;
- x %= 8;
- const clock_t time = clock();
- int r = 0;
- for (int i = 0; i < 1234567890; i++) {
- x = (x + d) % 8;
- switch (x) {
- case 1:
- r += 2;
- break;
- case 3:
- r += 6;
- break;
- case 5:
- r += 9;
- case 7:
- r += 5;
- break;
- default:
- r -= 3;
- }
- }
- std::cout << r << std::endl;
- const int divisor = CLOCKS_PER_SEC / 1000;
- std::cout << (clock() - time) / divisor << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement