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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
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 |
---|