zoukankan      html  css  js  c++  java
  • 小x的奇遇-adventure

    http://oj.saikr.com/problem/IPC3-A

     

     

     

    #include <bits/stdc++.h>
    #define inf 2333333333333333
    #define N 1000010
    #define p(a) putchar(a)
    #define For(i,a,b) for(long long i=a;i<=b;++i)
    //by war
    //2020.11.17
    using namespace std;
    long long T,n,k,m,t,mod=1000000007;
    void in(long long &x){
        long long y=1;char c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')y=-1;c=getchar();}
        while(c<='9'&&c>='0'){ x=(x<<1)+(x<<3)+c-'0';c=getchar();}
        x*=y;
    }
    void o(long long x){
        if(x<0){p('-');x=-x;}
        if(x>9)o(x/10);
        p(x%10+'0');
    }
    
    long long eular(long long x){
        long long ans=x;
        t=sqrt(x);
        For(i,2,t){
            if(x%i==0) ans=ans/i*(i-1);
            while(x%i==0) x/=i;
        }
        if(x>1) ans=ans/x*(x-1);
        return ans;
    }
    
    signed main(){
        in(T);
        while(T--){
            in(n);in(k);
            m=(k+1)/2;
            for(long long i=1;i<=m && n>1;i++){
                n=eular(n);
            }
            o(n%mod);p('
    ');
        }
        return 0;
    }
  • 相关阅读:
    C++中的类模板详细讲述
    函数模板和模板函数
    vs2008 快捷键大全
    #宏定义##
    多工程项目设置
    conemu 配置
    itcast-svn
    itcast-spring-三大框架整合
    Spring通知方法错误
    动态代理
  • 原文地址:https://www.cnblogs.com/war1111/p/13993120.html
Copyright © 2011-2022 走看看