ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) 解题报告
2017-02-24 08:50
435 查看
A:A Serial Killer
View Code
1 #include <iostream> 2 //#include<bits/stdc++.h> 3 #include <stack> 4 #include <queue> 5 #include <map> 6 #include <set> 7 #include <cstdio> 8 #include <cstring> 9 #include <algorithm> 10 #include <math.h> 11 using namespace std; 12 typedef long long ll; 13 typedef unsigned long long ull; 14 const ll MOD= 1e9+7; 15 ll eu(ll x) 16 { 17 ll t=x; 18 for(ll i=2;i*i<=t;i++) 19 { 20 if(t%i==0) 21 x=x/i*(i-1); 22 while(t%i==0) 23 t/=i; 24 } 25 if(t-1) 26 x=x/t*(t-1); 27 return x; 28 } 29 int main() 30 { 31 ll n,k; 32 cin>>n>>k; 33 while(n>1&&k>0) 34 { 35 if(k%2==1) 36 n=eu(n); 37 k--; 38 } 39 cout<<n%MOD<<"\n"; 40 }
View Code
相关文章推荐
- 【解题报告】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)A. A Serial Killer(水题)
- 【枚举】【前缀和】【map】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals
- 【2-SAT】【并查集】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) D. The Door Problem
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals
- [Updating]ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) 题解(A-E)
- 【前缀和 && 思维转换】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)Molly's Chemicals
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) A
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) E. The Holmes Children
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) A map B贪心 C思路前缀
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) D