#P5430. [SNOI2017] 礼物 加强版
[SNOI2017] 礼物 加强版
Description
The hospitable little monkey invites friends from the forest to dinner. His friends are numbered from to . Each friend who arrives brings him some gifts: big bananas. The first friend brings him big banana. After that, when each friend arrives, they will bring the total number of gifts brought by all previous friends, plus their index raised to the -th power.
So, if , the number of gifts brought by the first few friends is:
If , the number of gifts brought by the first few friends is:
Now, the little monkey is curious about how many gifts he will receive from the -th friend, so he asks you for help.
Given , output the number of gifts brought by the -th friend .
Input Format
The first line contains two integers .
Output Format
Output one integer, representing the number of gifts brought by the -th friend .
4 2
37
2333333 2
514898185
1234567890000 3
891659731
1000000013 10
616417347
Hint
of the testdata: .
Another of the testdata: .
The first of the testdata: .
The first of the testdata: .
The first of the testdata: .
The first of the testdata: .
of the testdata: .
The time limit for the last test point is , and for the others it is .
NaCly_Fish: The original testdata for this problem was incorrect and has now been fixed.
Translated by ChatGPT 5
京公网安备 11011102002149号