Problem Code: HS08TEST
The initial solution in C to this problem seemed okay to me, and so it did to the codechef engine.
#include<stdio.h> int main() { int wd; //withdraw amount float bal; //initial account balance scanf("%d%f",&wd,&bal); if(bal-wd>=0.5 && wd%5==0) //enough balance for bank charge, and withdrawal amount multiple of 5. printf("%0.2f",bal-wd-0.5); //print new balance. else printf("%0.2f",bal); //if not enough money, print current account balance. return 0; }
1st Attempt – Accepted – 0.0 Time – 1.6M Memory