A小x的奇遇-adventure
#include <cstdio>
const int N = 1e6 + 5;
int tot, p[N];
bool flg[N];
void sieve(int n){
for(int i=2; i<=n; i++){
if(!flg[i]){
p[++tot] = i;
}
for(int j=1; j<=tot&&i*p[j]<=n; ++j){
flg[i*p[j]] = 1;
if(i%p[j]==0){
break;
}
}
}
}
long long phi(long long x){
long long ans = x;
for(int i=1; i<=tot&& 1ll*p[i]*p[i]; ++i){
if(x%p[i]){
continue;
}
ans = ans/p[i]*(p[i]-1);
while(x%p[i]==0){
x /= p[i];
}
}
if(x>1){
ans = ans / (x * (x - 1));
}
return ans;
}
int main() {
sieve(N - 5);
long long n, k;
scanf("%llld%lld", &n, &k);
k = (k + 1) / 2;
for(long long i=1; i<=k&&n>1; ++i){
n = phi(n);
}
printf("%lld\n", n%1000000007);
return 0;
}
B数位dp-dp
#include <iostream>
#include <cmath>
using namespace std;
int work(int x){
int L = 0, R = -1, lst = -1; //L最高位 R最低位 lst上一位数
while(x){
int tmp = x % 10;
L = tmp;
if(R==-1){
R = tmp;
}
/*相邻来两位>7*/
if(lst!=-1){
if(abs(tmp-lst)>7){
return 0;
}
}
lst = tmp;
x /= 10;
}
/*最高位和最低位差值>2*/
return abs(R-L)>2;
}
int main(){
int cnt = 0;
for(int i=13930; i<=457439; i++){
cnt += work(i);
}
cout<<cnt;
return 0;
}
F大数据分析-data
#include <iostream>
using namespace std;
int main(){
//ans累计,now当前的那个数
long long ans = 1, now = 1, MOD = 1000000007ll;
for(int i=2; i<=30; i++){
now = now * (now + 5);
now %= MOD;
ans += now;
ans %= MOD;
}
cout << ans;
return 0;
}