My issue
My code
#include <stdio.h>
int main(void) {
// your code goes here
return 0;
}
Problem Link: TENPACKETS Problem - CodeChef
#include <stdio.h>
int main(void) {
// your code goes here
return 0;
}
Problem Link: TENPACKETS Problem - CodeChef
In this problem, the logic I used to solve it was like this;
We have been given cost of 2 packets and cost of 4 packets. If the cost of 4 packets is less than twice that of cost of 2 packets, we would need to buy 10 packets as; ( 4+ 4 + 2).
Otherwise, it will be ( 2 + 2+ 2+ 2+ 2).
Here is my code for reference.
# cook your dish here
for _ in range(int(input())):
x,y=map(int,input().split())
if(y<=(2*x)):
print((2*y)+x)
else:
print(5*x)