听写

数位分离

while (x){ //只要x不为0
	int t = x % 10; //x的个位
	x /= 10; //去掉x的各位
}

循环求最值

int n;
cin>>n;
long long maxv = 0; //最大值,初始为一个很小的值
for (int i=1;i<=n;i++){
	long long x;
	cin>>x;
	if (x>maxv) maxv = x;
}
cout<<maxv<<endl;

判断质数

质数

自幂数

int n;
cin>>n;
int cnt = 0; //个数
int x = n;
int f[100];
while (x){
	f[cnt++] = x%10;
	x/=10;
}
int ans = 0;
for (int i=0;i<cnt;i++){
	ans += pow(f[i],cnt);
}

枚举