Problem Description Link
Algorithm:
To solve this problem you follow just simple trick.
you get input a and b
sum=(a+b)/2;
diff=(a-b)/2;
if(sum+diff=a && sum-diff=b)
then print sum and diff
otherwise print impossible
Algorithm:
To solve this problem you follow just simple trick.
you get input a and b
sum=(a+b)/2;
diff=(a-b)/2;
if(sum+diff=a && sum-diff=b)
then print sum and diff
otherwise print impossible
No comments:
Post a Comment
Write your comment - Share Knowledge and Experience