您的位置:首页 > 其它

CodeForces 630 L. Cracking the Code(水~)

2016-02-21 10:39 357 查看
Description

给出一个五位数abcde,对这个五位数做两步操作

第一步:重组为一个新的五位数acedb

第二步:输出acedb^5的后五位

Input

一个五位数abcde

Output

输出acedb^5的后五位

Sample Input

12345

Sample Output

71232

Solution

水题,注意乘的时候会爆int,要以05d%输出

Code

#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
int n;
int main()
{
while(~scanf("%d",&n))
{
int m=n/10000*10000+n/100%10*1000+n%10*100+n/10%10*10+n/1000%10;
ll ans=1ll;
for(int i=0;i<5;i++)ans=ans*m%100000;
printf("%05d\n",ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: