zoukankan      html  css  js  c++  java
  • 数论 --- 找规律

    A hard puzzle

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 28099    Accepted Submission(s): 10019


    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 the a^b's the last digit number.But everybody is too lazy to slove this problem,so they remit to you who is wise.
     
    Input
    There are mutiple test cases. Each test cases consists of two numbers a and b(0<a,b<=2^30)
     
    Output
    For each test case, you should output the a^b's last digit number.
     
    Sample Input
    7 66 8 800
     
    Sample Output
    9 6
     
    【题目分析】
    就是简单的找规律,规律很强。
     
    #include<cstdio>
    int fun[10][4]=
    {
        0,0,0,0,
        1,1,1,1,
        2,4,8,6,
        3,9,7,1,
        4,6,4,6,
        5,5,5,5,
        6,6,6,6,
        7,9,3,1,
        8,4,2,6,
        9,1,9,1
    };
    int main()
    {
        int a,b;
        while(scanf("%d%d",&a,&b)!=EOF)
        {
            printf("%d
    ",fun[a%10][(b-1)%4]);
        }
        return 0;
    }
  • 相关阅读:
    字串变换
    单词接龙
    二叉搜索树
    搜索专题(未完)
    单调栈
    单调队列练习(切蛋糕&好消息,坏消息)
    队列专题
    滑动窗口/【模板】单调队列
    Linux下如何查看硬件信息?
    Git 居然可以用来跟女神聊天?
  • 原文地址:https://www.cnblogs.com/crazyacking/p/3755314.html
Copyright © 2011-2022 走看看