zoukankan      html  css  js  c++  java
  • Experimental Educational Round: VolBIT Formulas Blitz A

    Description

    The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, n can be rather big, and one cannot find the power using a calculator, but we need people who are able to think, not just follow the instructions."

    Could you pass the interview in the machine vision company in IT City?

    Input

    The only line of the input contains a single integer n (2 ≤ n ≤ 2·1018) — the power in which you need to raise number 5.

    Output

    Output the last two digits of 5n without spaces between them.

    Examples
    input
    2
    output
    25
    实际上,结果就是25,不放心可以用快速幂取模
    #include<stdio.h>
    //#include<bits/stdc++.h>
    #include<string.h>
    #include<iostream>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<queue>
    #include<map>
    #include<vector>
    #include<algorithm>
    #include<limits.h>
    #define inf 0x7fffffff
    #define INF 0x7fffffffffffffff
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define ULL unsigned long long
    using namespace std;
    LL modl(LL a, LL b, LL c)        //快速幂取余a^b%c
    {
        LL res, t;
        res = 1 % c;
        t = a % c;
        while (b)
        {
            if (b & 1)
            {
                res = res * t % c;
            }
            t = t * t % c;
            b >>= 1;
        }
        return res;
    }
    int main()
    {
        LL n;
        cin>>n;
        cout<<modl(5,n,100);
        return 0;
    }
    

      

  • 相关阅读:
    C语言I博客作业05
    C语言I博客作业04
    C语言II博客作业04
    C语言II博客作业03
    C语言II—作业02
    C语言II博客作业01
    学期总结
    C语言I博客作业08
    C语言I博客作业07
    C语言I博客作业06
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5204097.html
Copyright © 2011-2022 走看看