|
|
вернуться в форумWhat wrong in my problem. Its giving correct answer for me but if fails test#1 itself. #include<stdio.h> int main() { long input; int output[100]; int i,j=0; scanf("%ld",&input); if (input<10) { printf("1%d",input); return 1; } while (input>9) { for(i=9;i>1;i--) { if(input%i == 0) { output[j]=i; printf("%d\n",i); j++; input/=i; break; } } if(i==1) { printf("-1"); return 1; } } output[j]=input; for(i=j;i>=0;i--) { printf("%d",output[i]); } return 1; } Re: What wrong in my problem. Its giving correct answer for me but if fails test#1 itself. Test: 51 Right answer: -1 Test: 6 Right answer: 6 Re: What wrong in my problem. Its giving correct answer for me but if fails test#1 itself. your output format is wrong commentary //printf("%d\n",i); |
|
|