Result: Accepted
Time: 1ms
Memory: 1092kB
#include<stdio.h>
int main(){
int T;
printf("");
scanf("%d",&T);
int i=0;
int input[100];
for(i;i<T;i++){
printf("");
scanf("%d",&input[i]);
}
int x,j=0;
int output;
for(j;j<i;j++){
for(x=2;x>0;x++){
int a, b, c, d;
a=input[j]/x;
b=input[j]%x;
c=b/x;
d=b%x;
if(a == 1&&b<x&&b == 7){
printf("%d",x);
if(j<i-1)
printf("\n");
else
break;
break;
}
else if(a == 1&&b>x&&c == 7&&d == 0){
printf("%d",x);
if(j<i-1)
printf("\n");
else
break;
break;
}
else if(x>=input[j]){
printf("-1");
if(j<i-1)
printf("\n");
else
break;
break;
}
}
}
return 0;
}