Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main () {
- int a [2021];
- a[0] = 1;
- a[1] = 1;
- cout << a[0] << endl;
- for (int i = 2; i <= 2019; i++) {
- if (i % 2 == 1) {
- a[i] = a[(i - 1) / 2] + 1;
- } else {
- a[i] = a[i / 2];
- }
- cout << a[i] << " ";
- }
- int c = 0;
- for (int i = 1; i <= 2019; i++) {
- c = a[i] == 9 ? c + 1 : c;
- }
- cout << endl << endl << c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement