B - B

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Submit Status

Description

求A^B的最后三位数表示的整数。 
说明:A^B的含义是“A的B次方” 
 

Input

输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。
 

Output

对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。 
 

Sample Input

2 3
12 6
6789 10000
0 0
 

Sample Output

8
984
1
 
 #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)&&(a!=||b!=))
{
int num=;
for(int i=;i<b;i++)
{
num*=a%;
num%=;
}
printf("%d\n",num%);
}
}

CDZSC_2015寒假新人(2)——数学 B的更多相关文章

  1. CDZSC_2015寒假新人(2)——数学 P

    P - P Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  2. CDZSC_2015寒假新人(2)——数学 H

    H - H Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  3. CDZSC_2015寒假新人(2)——数学 G

    G - G Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  4. CDZSC_2015寒假新人(2)——数学 D

    D - D Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  5. CDZSC_2015寒假新人(2)——数学 C

    C - C Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  6. CDZSC_2015寒假新人(2)——数学 A

    A - A Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  7. CDZSC_2015寒假新人(1)——基础 i

    Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...

  8. CDZSC_2015寒假新人(1)——基础 h

    Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...

  9. CDZSC_2015寒假新人(1)——基础 g

    Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...

随机推荐

  1. Oracle11g R2学习系列 之三教程选择

    工欲善其事必先利其器,选择一本入门教程也是很重要的,本人使用的也是这位同事推荐的电子工业出版社的<<Oracle 实用教程(第3版)>>郑阿奇主编,可以至这里购买到,我个人还是 ...

  2. js判断上传文件的类型和大小

    //检测文件大小和类型 function fileChange(target){ //检测上传文件的类型 if(!(/(?:jpg|gif|png|jpeg)$/i.test(target.value ...

  3. un ange frappe a ma porte

    Un signe, une larme 魂牵 泪扰 un mot, une arme 字断 情烧 nettoyer les étoiles à l'alcool de mon ame 灵魂之酒眷洗 星 ...

  4. Jasper_table_pass parameter to table component

    <subDataset name="Dataset1" uuid="2a894ef4-dbcc-47df-bfaf-027766c7352e"> 2 ...

  5. Python网络编程踩的坑

    错误:socket.error: [Errno 10013] 原因:端口号被占用 解决:换其他的端口号或者将其他应用的端口号关闭 错误:File "D:/pyworkspace/homewo ...

  6. ReactiveCocoa v2.5 源码解析 之 架构总览

    ReactiveCocoa 是一个 iOS 中的函数式响应式编程框架,它受 Functional Reactive Programming 的启发,是 Justin Spahr-Summers 和 J ...

  7. Javascript中Function,Object,Prototypes,__proto__等概念详解

    http://anykoro.sinaapp.com/2012/01/31/javascript%E4%B8%ADfunctionobjectprototypes__proto__%E7%AD%89% ...

  8. cf C. Tourist Problem

    http://codeforces.com/contest/340/problem/C #include <cstdio> #include <cstring> #includ ...

  9. 【CDOJ931】Car race game(树状数组求逆序)

    题目连接:http://acm.uestc.edu.cn/#/problem/show/931 OJ评判系统有些坑,不支持__int64以及输出的%I64d大家注意.全开long long也会TLE, ...

  10. c++智能指针《二》 std::tr1::shared_ptr

    转载http://www.cnblogs.com/kadinzhu/archive/2011/12/12/2284826.html 看<effective c++>,作者一直强调用std: ...