Hello, I have a problem need to solve:
S(n) = 1^k + 2^k +..+n^k
input: n<=10^9, k<=40
output: S(n)%(10^9+7).
One more issue:
how to calculate ((n^k)/x)%p which very big n and k.
Thank for helping me.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hello, I have a problem need to solve:
S(n) = 1^k + 2^k +..+n^k
input: n<=10^9, k<=40
output: S(n)%(10^9+7).
One more issue:
how to calculate ((n^k)/x)%p which very big n and k.
Thank for helping me.
Hello everybody. That is my code to show binary a decimal number. It's right when a>=0 but when a<0 that can't work, infinite loop. And I don't know what wrong in this code. Can you help me to solve? Thank so much!
void bi(int a)
{
if(a==0)
return;
bi(a>>1);
cout<<(a & (1));
}
//I have a nother code and it's right in both case. However I want to know what happen with this code. Sorry for my bad English
Hello everybody, my English not good, I wish many people can understand what I wrote :D You know "|" and "||" are meaning "or", "&" and "&&" are meaning "and" then what is difference ? Look at this code
int a = 0,b = 1;
if(b||a++);
cout<<a;
output: 0
int a = 0,b = 1;
if(b|a++);
cout<<a;
output: 1 I don't know why but I think || and && is smart, in this example when b==1 (true) then b "or" something is true, so "||" don't care after if sentese true in anyway. And "&&" is the same,
int a = 0,b = 1;
if(a && b++);
cout<<b;
int a = 0,b = 1;
if(a & b++);
cout<<b;
let try and see :). That is my second blog, My first blog is very bad, I wish this blog is better, sorry because my english is very bad. Thank for reading !
Name |
---|