WA in C, accepted in C++, same code

Riddle:
The following code results in WA when compiled as C and gets “Accepted” when compiled as C++: http://www.codechef.com/viewsolution/2684428
Why is that?


#include <stdio.h>
#include <string.h>
#define s(format, ...) scanf(format, #### __VA_ARGS__)
 
int i, T, N, P, d[17], a[50], b[50];
float prob[50], ptot;
 
void solve(int lvl, float p, int d[])
{
  if (lvl <= N)
    {
      if (d[a[lvl]] == 0)
        {
          d[a[lvl]] = 1;
          solve(lvl+1, p*prob[lvl], d);
          d[a[lvl]] = 0;
        }
      if (d[b[lvl]] == 0)
        {
          d[b[lvl]] = 1;
          solve(lvl+1, p*(1.0 - prob[lvl]), d);
          d[b[lvl]] = 0;
        }
    }
  if (lvl > N)
      ptot += p;
}
 
int main()
{
  //freopen("in.txt", "r", stdin);
  s("%d",&T);
  while (T--)
    {
      ptot = 0.0;
      s("%d", &N);
      for (i = 1; i <= N; ++i)
        {
          s("%d %d %d", &P, &a[i], &b[i]);
          prob[i] = (float)P/100.0;
        }
        if (N < 17)
         {
           memset(&d[0], 0, sizeof(int)*17);
           solve(1, 1.0, d);
         }
      printf("%.9lf\n", ptot);
    }
  return 0;
}
</pre>