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;
    }
  • 相关阅读:
    0523注册审核
    0520三级联动
    0519考试练习题
    0516ajax
    mysql 高级查询
    mysql
    HTML的格局与布局
    css样式表
    HTML表单
    HTML
  • 原文地址:https://www.cnblogs.com/crazyacking/p/3755314.html
Copyright © 2011-2022 走看看