+ 1

"Haaloween candy" problem

I have solved Halloween candy problem, it matches first two test cases but fail last 3 cases.what are the possible reason,can someone tell me please??I need solution.

21st Apr 2020, 7:10 AM
Shafiqul Islam
Shafiqul Islam - avatar
7 ответов
+ 1
Thanks my friend,I got idea from your code,just change the round() function to ceil() function.now it is ok.
21st Apr 2020, 8:33 AM
Shafiqul Islam
Shafiqul Islam - avatar
0
In which language???
21st Apr 2020, 7:38 AM
ANJALI SAHU
0
Please Show us your attempt
21st Apr 2020, 7:38 AM
ANJALI SAHU
0
#include <stdio.h> #include <math.h> int main() { int houses; scanf("%d", &houses); //your code goes here float p; p=(2.0/houses)*100; float result=round(p); printf("%.0f",result); return 0; }
21st Apr 2020, 8:05 AM
Shafiqul Islam
Shafiqul Islam - avatar
0
First case and second case is ok,but remaining are not.
21st Apr 2020, 8:06 AM
Shafiqul Islam
Shafiqul Islam - avatar
0
This is of Python... import math houses = int(input()) print(math.ceil(2/houses*100))
21st Apr 2020, 8:25 AM
ANJALI SAHU
0
☺️
21st Apr 2020, 8:48 AM
ANJALI SAHU