http://zerojudge.tw/ShowProblem?problemid=d636
- 二分法
- 邊乘邊 Mod
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <iostream> #include <cstdlib> #include <cmath> using namespace std; int main() { long long int a = 0,b = 0; while(cin>>a>>b) { a %= 10007; long long int Ans = 0; Ans = pow((long double)a,(long double)b); cout<<(Ans%10007)<<endl; } return 0; } |
沒有留言:
張貼留言