Bytelandian gold coins :WA

here my code:

#define max(a,b)     (a>b)? a : b
int main()
    long long t;
          int has=t;

i dont know what wrong with it… please help

try and rethink on the problem statement…your algo is not correct…you can divide ur amt into change many times…like…

if u have an amt n…u can divide it into n/2 n/3 & n/4

let a=n/2 b=n/3 and c=n/4

you can further divide a into a/2 a/3 & a/4…same for b and c…you need to do this until the sum of the divisions does not become optimum(constant) it is a Dynamic Programming(DP) Problem…hope this helps…:slight_smile:

@kunal361 after breaking it again some part will again go to the bank as tax, and the total value decreases. so why should we have to break it again?

@harshitbhatt69 Did you check the date when @kunal361 had posted his response? :laughing:

1 Like