|
|
back to boardCan Anyone Identify The Mistake #include<stdio.h> int val(int n) { int i,count=0; if(n<=0) return n; else { for(i=1;i<=(int)sqrt(n);i++) { if(n%i==0) count++; } return count; } } int main() { int flag,m,n,k,i; flag=0; scanf("%d %d %d",&m,&n,&k); for(i=1;i<=10000;i++) { if(val(i)==n&&val(i-k)==m) { flag=1; break; } } if(flag==1) printf("%d",i); else printf("0"); //system("pause"); return 0; } I am Getting Wrong Answer For Test Case 1 Itself But i am getting the right answer 16 For The Input Cases Re: Can Anyone Identify The Mistake Try the following test. It has helped me. 1 3 1 Right answer is 12 |
|
|