Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include "BigInt.h"
- using namespace std;
- unsigned short sumDigits(const BigInt& number)
- {
- unsigned short sum = 0;
- for (const auto &ch : number.getDigits())
- sum += ch - '0';
- return sum;
- }
- int main()
- {
- string szInput;
- cin >> szInput;
- BigInt start(szInput);
- cin >> szInput;
- BigInt end(szInput);
- unsigned short remainder9 = (9 - sumDigits(start) % 9) % 9;
- unsigned short remainder5 = (start.getDigits().back() - '0' + remainder9) % 5;
- unsigned short remainder45 = 9 * remainder5 + remainder9;
- BigInt current = start + remainder45;
- while(current < end)
- {
- cout << current << endl;
- current += 45;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement