​题目传送门​​ 代码:

#include<cstdio>
#include<cmath>
using namespace std;

typedef long long LL;

int main(){

int k,C=0;
while(scanf("%d",&k)==1){

if(k==1){

printf("Case %d: Impossible\n",++C);
continue;
}
LL key;
bool isok=false;
for(int i=2;i<=40000 && i<=k;i++){

key=i;
int node=-1;
for(int j=i-1;j>=1;j--){

if(key==k){

node=j;
break;
}
else if(key>k) break;
key*=j;
}
if(node!=-1){

isok=true;
printf("Case %d: %d %d\n",++C,i,node);
break;
}
}
if(!isok) printf("Case %d: %d %d\n",++C,k,k-1);
}
}