原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2035

思路:(网上学来的,偏向数学的不咋懂/捂脸)每次乘法的时候都取后三位(可能有些含糊,直接看代码吧,一看就懂)

source code:

package hduoj;

import java.util.Scanner;

public class hdoj_2035 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int a = sc.nextInt();
int b = sc.nextInt();
if(a==0&&b==0) break;
if(b==0){
System.out.println(1);
continue;
}
a %= 1000;
int r = 1;
for(int i = 0;i<b;++i){
r = r*a%1000;
}
System.out.println(r);
}
}
}

代码已经ac

希望对大家有所帮助

以上

最新文章

  1. 10月24日上午PHP面向对象
  2. ubuntu 14.04 下evolution邮箱客户端设置(腾讯企业邮箱)
  3. DOM--2 创建可重用的对象
  4. jquery冲突细节
  5. https证书申请
  6. AudioServicesPlaySystemSound音频服务—备用
  7. 利用boost获取时间并格式化
  8. 排序(6)---------归并排序(C语言实现)
  9. POJ2115(扩展欧几里得)
  10. Struts2基础学习(四)&mdash;类型转换器和数据校验
  11. NSUserDefaults registerDefaults
  12. python爬虫(七)_urllib2:urlerror和httperror
  13. Cisco Port-Channel 设置(链路聚合)
  14. 如何在idea中调试spring bean
  15. rxjava&amp;retrofit请求直接返回string
  16. requirements文件
  17. 哈希函数(hash函数)
  18. Python *Mix_w6
  19. win10上安装keras
  20. jstl函数的使用

热门文章

  1. 《C# 6.0 本质论》 - 学习笔记
  2. AndroidStudio报错:GradleSyncIssues-Could not install Gradle distribution from...
  3. PHP0025:PHP 博客项目开发2
  4. B样条曲线方程和C++实现
  5. C#面向对象--结构
  6. springboot快速创建项目框架
  7. 【Android】安卓Q适配指南-相册
  8. Anaconda切换工作目录盘符
  9. PostgreSQL内核学习笔记四(SQL引擎)
  10. too many open files异常及解决办法