(HDU)1097 --A hard puzzle(难题)

题目链接:http://vjudge.net/problem/HDU-1097

这题和前面出现的一道N的N次幂的原理是一样的,不明白的可以去看那题;

 1     #include <iostream>
 2     #include <cstdio>
 3     #include <cstring>
 4     using namespace std;
 5
 6     int main()
 7     {
 8         int a,b,ans[4];
 9         while(~scanf("%d %d",&a,&b))
10         {
11             a%=10;
12             ans[1]=a;
13             ans[2]=a*a%10;
14             ans[3]=a*a*a%10;
15             ans[0]=a*a*a*a%10;
16             b%=4;
17             printf("%d\n",ans[b]);
18         }
19         return 0;
20     }

时间: 2024-10-27 11:03:47

(HDU)1097 --A hard puzzle(难题)的相关文章

[2016-02-05][HDU][1097][A hard puzzle]

[2016-02-05][HDU][1097][A hard puzzle] HDU - 1097 A hard puzzle Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Submit Status Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know

hdu 1097 A hard puzzle

Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.this puzzle describes that: gave a and b,how to know

HDU 1097.A hard puzzle【快速幂或规律】【8月12】

A hard puzzle Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin. this puzzle describes that: gave a and

HDU - 1097 - A hard puzzle (快速幂取模)

A hard puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 32633    Accepted Submission(s): 11672 Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a a

杭电 HDU 1097 A hard puzzle

A hard puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 32851    Accepted Submission(s): 11754 Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius:  gave a

HDU 1097 A hard puzzle【快速幂取模运算】

A hard puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 30984    Accepted Submission(s): 11109 Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a a

HDU 1097 A hard puzzle(快速幂)

Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.this puzzle describes that: gave a and b,how to know

HDU 1098 Ignatius&#39;s puzzle(数论-其它)

Ignatius's puzzle Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Eddy. this problem describes that:f(x)=5*x^13+13*x^5+k*a*x,input a nonegative integer k(k<10000),to find the minimal

HDU 1098 Ignatius&#39;s puzzle 费马小定理+扩展欧几里德算法

题目大意: 给定k,找到一个满足的a使任意的x都满足 f(x)=5*x^13+13*x^5+k*a*x 被65整除 推证: f(x) = (5*x^12 + 13 * x^4 + ak) * x 因为x可以任意取 那么不能总是满足 65|x 那么必须是 65 | (5*x^12 + 13 * x^4 + ak) 那么就是说 x^12 / 13 + x^4 / 5 + ak / 65 正好是一个整数 假设能找到满足的a , 那么将 ak / 65 分进x^12 / 13 + x^4 / 5中得到