WA with doubles. Went to forum and they say do scanf("%d.%d"...)
AC.
Problem was with the output format.
Also changed to use int instead of double.