Is this a joke or are you trying to get Jow Forums to do this for you?
Zachary Clark
>Is this a joke or are you trying to get Jow Forums to do this for you?
I already failed as you can see by the time. I just wondered if this question is complete nonsense or I am a moron?
I answered if (goal - 5) >= 5 { return goal - 5 } else { return -1 }
Just because I banged my head against this and thought it was stupid I would like to know what others think of it. Who's absurd? The question or me?
Wyatt Phillips
I don't care if it's solved. I said I COULD SOLVE IT IF IT MADE SENSE. Does this question make sense?
Thomas Barnes
Judging by the "answer" you posted and the fact that you even made this thread, I'd say you're probably around room temperature IQ. Not too low so as to be incapable of making a thread on Jow Forums, but not high enough to know better.
Zachary Phillips
It makes perfect sense.
Aiden Miller
>I'd say you're probably around room temperature IQ.
You'll write to be an asshole but you won't even read the question. >"Return -1 if it cannot be done" If what cannot be done?
>"If there isn't enough return -1" If there isn't enough what? Cookies to use a 5 kilo bag? Bags? Cookies? They didn't give a quantity of bags.
You didn't even look at the question, dickface.
Adrian Thompson
Yes the question makes sense, just return goal % 5
Back in the days people like you worked on the factory floor and had a happy life Nowadays we have to see this sad display of incompetence Ted was right
Christopher Stewart
>They didn't give a quantity of bags. Read. The. Fucking. Question. >INPUT >INT SMALL: NUMBER OF SMALL BAGS >INT BIG: NUMBER OF BIG BAGS Yes, just ignore the other 2 inputs, retard.
Jordan Sanders
holy fucking brainlet, I hope this isn't a uni course
Justin Garcia
>They didn't give a quantity of bags. You don't need to know the quantity to write a program for it. Even a non programmer brainlet like me knows this.
Ayden Hughes
You were supposed to use variables user...
Caleb Hill
Are you really not capable of doing this? Why are you even trying then lol.
Cameron Rodriguez
>failed the question try actually using the big bag count instead of assuming that you have enough small bags required = goal%(n big bags * 5) return (small bags required) failed the english language
Ryan Torres
US is only country that does this shit. It means nothing at all.
Adam Morris
You're just retarded. This is a basic greedy algorithm.
Something like
goal -= big * 5; if (goal < 0) return 0; if (goal > small) return -1; return small;
should solve the problem.
Julian Roberts
>You don't need to know the quantity to write a program for it I didn't know what they were talking about. They're talking about an event where the cookies will only weight exactly 5 kilos or '1' kilo increments above 5?
>failed the english language I hadn't done any coding questions. I didn't go to college. I build many elaborate projects and pipelines The problems I deal with are typically not riddles and I design the most efficient code to bridge it.
Levi Williams
Lmao that code isn't even syntactically correct.
Also JS makes semicolons optional but you should still use them.
Luis Reed
I'm typing this on my phone so sorry for the formatting
function Package(small, big, goal){ ayylmao = goal % 5; if (ayylmaosmall) ? -1:goal; }
Julian Bailey
both of these fail on n big bags * 5 > goal
clamp big * 5 to goal - goal%5
Cameron Davis
They just want you to tell them how many small bags need to be shipped, assuming that you use big bags first. It's just tapping into your remainder knowledge. Pretty basic shit.
Lincoln Hall
>small bags required = goal%(n big bags * 5) Still wrong.
If goal is 12 and n big bags is 1, this would set small bags required to 2 when it should be 7.
Am I the only employed programmer in this thread?
Jaxon Martin
True.
Camden Robinson
>You don't need to know the quantity to write a program for it youre OP right?? and nayrt, but youre fucking stupid this is basic shit and the question is really easy to understand maybe you should give the whole... programming thing a miss
Nicholas Morris
>They just want you to tell them how many small bags need to be shipped, assuming that you use big bags first.
So 'if goal
Oliver Morales
Doesn't work, there might not be enough big bags to fit all of goal.
Jayden Ross
>youre OP right?? youre fucking stupid
You could have just explained what they were asking for instead of being a dick. Jow Forums are bunch of loser assholes. It's return goal - 5 else if goal is < 5 return -1? I can answer a clear question.
Isaiah Nguyen
Wrote it in C++ and made it ez to read for your puny brain
#include
#define LARGE_SZ 5 #define SMALL_SZ 1
int Package(int small, int big, int goal) { const int remainder = goal % LARGE_SZ ; const int total = (small * SMALL_SZ) + (big * LARGE_SZ) ; if(total >= goal) return remainder ; else return -1 ; } int main() { std::cout
Charles Flores
why is it wrong to just ship 4 small bags with any order over 5 kg?
Carter Jones
Are you all retarded? Check for the big bags, then check the remainder for small bags, then check if they are inside the bounds. Jesus Christ.
Caleb Roberts
how would that work for 6kg?
Carson Hill
doesnt make you not stupid
Cooper Edwards
I’m employed too and the answer according to our protocols is call Rockwell’s support line then fly an engineer to their training facility and have them tell him how it is done. Ship the result directly to customer and leave no documentation whatsoever.
Robert Russell
Idiot, what if you have to send 6kg? Or anything that isn't 5*n+4, fucking brainlet.
Brayden Jenkins
I'm not even a programmer or CS student and I could solve that. >goal % 5 = number of small bags >check if that number
Grayson Allen
>doesnt make you not stupid What? You being a depressed rageaholic? Why'd you respond again without telling me if I got the question clear?
Dominic Williams
You ship 9kg as computation time is more expensive than 4kg of cookies
Oliver Scott
Just say they are bonus bags. They are cookies. They don't cost much.
Bentley Collins
I this has a math error if goal < (nBigBags * 5). For example 5 % 10 = 5, which would be wrong since you use big bags first return (goal
>What? You being a depressed rageaholic? this literally makes no sense as a reply to my statement and i didnt tell you if you got the question clear because countless other anons have explained it to you and if you STILL dont understand then im just going to double down on what i first said... youre fucking stupid making me hungry baka
Parker Myers
ugly
Robert Reed
function package(small, big, goal) { return (goal
Adam Reed
Elitist asshole on the internet. I never.
Jaxon Smith
you should still use big bag even if it has more capacity than the goal
Elijah Thomas
just leave
Julian Ramirez
dis nigga doesn't know the % operator lmfao
Colton Bennett
and you don't understand the question.
Gavin Hughes
Na this is a fail, what happens if there are two big bags? This function doesn't cut grass.
Andrew Bell
retard. it's hillarious watching you trying to reverse engineer this simple question from anons' answers
Daniel Howard
>just leave You don't understand the question. You just think this thread is an opportunity to pile on someone.
Ethan Parker
yea i do
Samuel Ortiz
his solution doesn't have this problem though
Henry Brooks
This user is right. Go practice at app.codesignal.com They have some good basic problems to make you think like a programmer.
Alexander Thompson
Fair. I feel like in a practical sense I would rather use one small bag for 1kg rather than waste a 5kg bag to store that same 1kg if that makes sense.
Jayden Thomas
True but question says 'assuming we always use big bags first'
Blake Gonzalez
>yea i do
Then why not just admit it was phrased poorly and add how it should be phrased more clearly with your ad hominems.
The -1 thing is really strange. Why would anyone need to have -1 returned if the cookies are less than 5 kilos? Just make it use small bags under 5.
"Cookies will be shipped in 5 kilo and 1 kilo bags. Write a function that returns the number of 1 kilos bags unless the amount of cookies is under 5 kilos return -1."
Gavin Wilson
return goal % 5 + (goal - big * 5);
Blake Davis
this user seems to have the correct answer function package(small, big, goal) { const weightSmall = 1; const weightBig = 5; let smallBagsUsed = 0
>They have some good basic problems to make you think like a programmer.
Nobody thinks like the question in the OP
Jace Price
> goal = 17 > big = 3 > goal % 5 + (goal - big * 5) result = 4
retard
Samuel Evans
because im not taking this thread seriously
Hudson Cook
function cookies(small, big, goal) { var totalkgbig = big * 5; var totalkg = small + totalkgbig; var r = goal % 5; if (r > small || totalkg < goal) return -1; return r; }
I won't be leaving my room for anything less than 100k, Mr. Goldberg.
>Blame everyone else for your deficiency I don't have a deficiency. I'm asking the internet about this question. I'm learning about the autistic language of coding questions. If you feel making empty insults to strangers asking questions and learning things over the internet gives you power over people you are wrong.
Ayden Martinez
>It's return goal - 5 else if goal is < 5 return -1? This thread is the gift that keeps on giving.
function foo(int small, int big, int goal) { if (small+big*5 < goal) return -1; return goal % big; }
Here's your homework, thanks for the laughs.
Jordan Torres
my code wasn't correct because I forgot about the -1 condition if you don't have enough but whatever
Jordan Brown
While the more esoteric one liners are impressive, the real world prefers readable well tested code.
Owen Rivera
>javascript >declares types in the function signature
don't call us, we'll call you security please escort this lady out
I don't touch JS if I can help it, but I assumed it would have static typing. Anyway I made an error where I assume it can use infinite big bags as long as the sum is larger than the goal, but it's easy to fix.
Isaac Edwards
foo(10, 0, 5) = NaN
Henry Collins
> and this gives you power over me?! Don't feel bad user no one cared who I was untill I put on the mask.
But legit either an elaborate troll or a loiving breathing Dunning-Kruger effect
Oliver Sullivan
there's no fucking way this isn't a troll nobody can actually be this stupid
Adam Ross
>cookies(12, 1, 17) >2
hahaha
Henry Cox
Issue closed, wontfix. function foo(var small, var big, var goal) { if (small+big*5 < goal) return -1; if (big) return goal % (big*5); return small; }
If they submit negative integers, it's their fault.
Noah Barnes
>Technically not in the question It literally says you will be given an inventory of small and big bags so obviously you have to make sure you have enough big bags.
Julian Rodriguez
>var small, var big, var goal see
Logan Martinez
It took me forever to understand the question because "small", "big" and "goal" were stylized as parameterized functions and I thought they wanted you to write 3 functions. But it's very ez once you understand the problem