Untitled
unknown
plain_text
a month ago
470 B
23
Indexable
Never
#include <iostream> #include <vector> using namespace std; int main() { vector<int> digits; int start_from = 3; int d = start_from; int carry = 0; while (true) { digits.push_back(d); int a = d * 3 + carry; d = a % 10; carry = a / 10; if (carry == 0 && d == start_from) break; } for (int i = digits.size() - 1; i >= 0; i--) cout << digits[i]; cout << endl; return 0; }
Leave a Comment