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 | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | 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 | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
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 |
---|