gdzie b jest liczbą naturalną należącą do przedziału [0…1000000000000].
Typ unsigned int nie pomieści takiej liczby:
#include <limits>
#include <iostream>
int main()
{
using type = unsigned int;
std::cout << "Min: " << std::numeric_limits<type>::min() << "\n";
std::cout << "Max: " << std::numeric_limits<type>::max() << "\n";
}
Możesz użyć np long.
PS. Pamiętaj zawsze sprawdzać skrajne testy 