Problem: http://www.codechef.com/problems/RECIPE difficulty:easy Hello, I have tried many times but i am unable to point out any errors (logical) errors in my code.I am getting a wrong answer for this code.It works fine on my machine giving correct output.Can anybody help me out. I have found the two smallest numbers(min1 and min2) and then their gcd. If the gcd is not 1 then i am checking whether their gcd divides all the remaining nos without leaving behind any remainder.If it is 1 i simply print all nos. If so then i divide all the numbers by the gcd and output the result. Else i simply output all the numbers.
using namespace std; int main() { int t,n,i,min1,min2,arr[50]; cin>>t; while(t) {
} asked 03 Aug '14, 15:49

@s_enterpreneur Consider the array : 8 16 22 Minimum(m1)=8 and second minimum(m2)=16. gcd(m1,m2)=gcd(8,16)=8 which is nonzero. =>your output is 1 2 2 (note that 22/8 =2) However required output is 4 8 11. Hope you understand. answered 04 Aug '14, 02:35
