日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nyoj473 A^B Problem (高速幂)

發布時間:2025/1/21 编程问答 164 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nyoj473 A^B Problem (高速幂) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

A^B Problem

時間限制:1000?ms ?|? 內存限制:65535?KB 難度:2 描寫敘述
Give you two numbers a and b,how to know the a^b's the last digit number.It looks so easy,but everybody is too lazy to slove this problem,so they remit to you who is wise. 輸入
There are mutiple test cases. Each test cases consists of two numbers a and b(0<=a,b<2^30)
輸出
For each test case, you should output the a^b's last digit number.
例子輸入
7 66 8 800
例子輸出
9 6
提示
There is no such case in which a = 0 && b = 0。
來源
hdu
上傳者
ACM_丁國強
#include <stdio.h> int main() {int a,b,_a,s;while(scanf("%d %d",&a,&b)!=EOF){if(a==0&&b==0)break;s=1;while(b){if(s>=10)s=s%10;if(a>=10)a=a%10;if(b%2==1)s=s*a;a=a*a;b=b/2; }if(s>=10)s=s%10;printf("%d\n",s);}return 0; }

總結

以上是生活随笔為你收集整理的nyoj473 A^B Problem (高速幂)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。