 What's up guys? Mine is Michael and welcome to my YouTube channel today. We are going to go over this problem called hangover This is actually not a difficult problem I'm not actually going to read the story to you because I think it's kind of useless, but basically You're just adding the number one half plus one third plus one fourth up to one over n plus one So this is like you're the function one half one third and up to n plus one So now what they're saying is that given this C? Number C you want to find the number n such that the summation from one half to One third to one over n plus one is going to be just greater than C So that's basically that boils down to the problem. So so n is like a n is a number that you're summing from one half one third one fourth up to one over n plus one and They give you a number C and you just have to make sure that You find the number that's just greater than Find us the n that is the who's sum that's just greater than this who some of the series is just greater than the C Value so I'm there's not much to it actually so you could just brute force this So I'm just going to explain the code to you guys because there's not much to it so the difference between spodge and the and code forces is that spodge Code forces give you gives you the number of test cases a spodge What they do is that you have to if you input zero Then the program should stop. So because of that. I just used to do what would do while loop So do while C is just the input C value which is a Each of the input values here of one One dot zero zero three, but dot seven one Right, and I just check if it's not equal to zero, right? And then if it's equal to zero then the program would stop. So that's what this would do while is okay So to brute force it basically we're just going to keep looping We keep looping and we're going to keep calculating the value and once it's greater than our C then we stop So that's basically the gist of this problem. So yeah, I create a value called zero Float value and I said to zero and I create a value of n I said to zero, right? Then what I'm doing is that a while while this current our current value is less than C Right the input value. We are going to add one to a value at our value n and then we are just going to plus equals to one over one plus n plus one Where we're gonna add one over n plus one to our value. So that's this part. So that's this part Right because we're just summing up one half plus one third plus one fourth up to one over n plus one And what we're doing is we're just gonna slowly increment n until we get to a point where the sum of one half one third one fourth up to n plus one of one over n plus one is going to be Greater than C greater than or equals a C. So that's what this while loop is. So yeah, so every time We're going through our values We're just gonna keep adding plus equal to one over one plus one over n plus one We're gonna keep adding that and then we're gonna add one to n Right because we're gonna we're just keep trying the value until it reaches it then at the end of the loop We just display n because that'll be the number of cards That'll be the end it will be the card number that is that is displayed So yeah, that's pretty much the gist of this problem once it gets to the end We just display it display and and make sure you guys put a space and then had add cards because That's what the input statement requires it for But yeah, that's basically the gist of the problem Basically, um, if I could explain the test cases If you guys want me to because I could just show it to you guys what I mean by that so like I Could explain what it what the test cases mean. So like let's say we add our C is equal to 1 Right our C goes to the one dot zero zero So basically in our in the equation one half plus one third up to One over n plus one. We want to find the value n such that this sum the summation is going to be just greater than C So basically what we're doing in our code is just we're just gonna keep adding one by n So we start n at zero Right and then it would add up one one one plus n plus one zero plus one would be one half it would add one half Right and then after this it'll add one third add one fourth and then sooner or later After this sum, you know, the sum is going to be greater than C and when that happens We just break right we end and when that happens this while it would be finished And then we would just have our value of n in which the case this this summation occurred and then we just display that Okay, and I check if C is not equal to zero because if C is equal to zero the program stops Right, so then then you know what you're not supposed to print anything. So yeah, that's pretty much just the problem I hope you guys understand this video is pretty short Raycom subscribe. I'll check you guys later. Peace