|
|
back to boardIs this looks like correct? Posted by PVD 27 Sep 2013 01:36 i have tested it, and it look like working, can you say me is this look like correct, or can you advise me how to fix it?) #include <iostream> using namespace std; int main() { unsigned __int64 n, b, i, r, sum = 0; cin>>n>>b; for (i = 2; i <= n - 1; i++) { r = (n - 1) / i + (n - 1) % i; sum += r * pow(double(b - 1), double(n - i)); } cout<<unsigned __int64(pow(double(b), double(n)) - pow(double(b), double(n - 1)) - sum)<<endl; //system("pause"); } |
|
|