+ 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.
7 odpowiedzi
+ 1
Thanks my friend,I got idea from your code,just change the round() function to ceil() function.now it is ok.
0
In which language???
0
Please Show us your attempt
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;
}
0
First case and second case is ok,but remaining are not.
0
This is of Python...
import math
houses = int(input())
print(math.ceil(2/houses*100))
0
☺️