Anonymous
Not "if someone replies"
Anonymous
It's just a time wasting
Roshan
No You should provide it right away
Ok opening my PC. Is it okay to provide <100 lines of code?
Anonymous
Ok opening my PC. Is it okay to provide <100 lines of code?
Read the rules, there's one about how to provide code
Anonymous
Yes, it's ok Using paste services
Roshan
Is it okay to paste <100 lines of code here please?
Manav
Is it okay to paste <100 lines of code here please?
Nope, anything more than 8 lines is annoying to look at
Manav
Use del.dog or hastebin.com
Manav
It's just an FAQ about what developers expect you to do when asking questions online
Anonymous
Bruh such arrogant ppl
Roshan
Yes
Thankyou pasting it here....
Anonymous
Thankyou pasting it here....
Not here paste.ubuntu.com
Manav
Yes
I think they'll paste the code here as text messages
Anonymous
hazer_hazer
/warn offtop
Danya, is everything okay at home?
Roshan
https://paste.ubuntu.com/p/rfcJyW5P9R/
Roshan
Is it done like this?
hazer_hazer
Wanna warn? :)
I Dare U, I **** dare u (C)
Anonymous
Roshan
https://paste.ubuntu.com/p/rfcJyW5P9R/
Pardon me if my code is bad, or not IDK, I'm new to C++
Anonymous
/warn screen photo
Manav
https://paste.ubuntu.com/p/rfcJyW5P9R/
That logic will not work you are finding maximum of minimums and minimum of maximums. I would suggest you use ranges to find the books possible.
Anonymous
For two integer arrays, the comparator value is the total number of elements in the first array such that there exists no integer in the second array with an absolute difference less than or equal to d. Find the comparator value. For example there are two arrays a = [7,5, 9), b = [ 13, 1, 4), and the integer d = 3. The absolute difference of a[0] to b[0] = / 7 - 13 7 = 6, b[1] = / 7-1 ) = 6, and b[2] = / 7-4/ = 3, to recap, the values are 6, 6, 3. In this case, the absolute difference with b[2] is equal to d = 3, so this element does not meet the criterion. A similar analysis of a[1] = 5 yields absolute differences of 8, 4, 1 and of a[2] = 9 yields 4, 8, 5. The only element of a that has an absolute difference with each element of b that is always greater than dis element a[2], thus the comparator value is 1. Can someone help mee
Manav
Manav
@Roshan_Pradhan1098 implement this, in a naive implementation, you would have to check N(2N-1) ranges, where N is the no of students
Anonymous
thanks!
Manav
Can you say some test cases where it wont work properly Manav?
5 1 5 1 5 1 5 1 5 11 12 Max of minimums = 11 Min of maximums = 5
Roshan
Thankyou for all of this Manav and Danya!! I'll check what's the problem😄
Manav
Your method will only work if all the ranges coincides
Tostisto
Hey can anyone advise me how to start with this task? I need to create a timer in the console that will be represented by a 2D array. The timer will run for only a minute ....
Pavel
Hey can anyone advise me how to start with this task? I need to create a timer in the console that will be represented by a 2D array. The timer will run for only a minute ....
Try to use the algorithm from "A naive line-drawing algorithm" section to fill your 2D array https://en.wikipedia.org/wiki/Line_drawing_algorithm
Pavel
And for the second line segment coordinate (the first one in the center) you can calculate it from the angle https://math.stackexchange.com/questions/180874/convert-angle-radians-to-a-heading-vector
Masha8899
need help Write a program that gives a discount of 100 pesos to a customer if the shirt bought is XL and the price is greater than 500 pesos; a discount of 50 pesos if the shirt bought is L and the price is greater than 400.
Masha8899
Masha8899
im having problem adding the size in my code
hdjdjdjjdj
you can scanf() the sizes as well
hdjdjdjjdj
and then add if or switch() statements to determine whether you will give a discount or not
Masha8899
Masha8899
also im having else without a previous if error
Roshan
@usernamestring
Roshan
I've changed the code for simplicity please review if it will work for all test cases (That Love for Maths question)
Roshan
https://hastebin.com/anesegihaz.cpp
Roshan
https://hastebin.com/anesegihaz.cpp
I see that I've resolved that issue you posed. But still it gives 1/3 test cases correct 🙁 Any more ideas?
olli
I see that I've resolved that issue you posed. But still it gives 1/3 test cases correct 🙁 Any more ideas?
does it say what fails? With this implementation you probably won't get all the test cases right, the constraints are fairly high (could be a timeout)
Roshan
Let me share results....
Roshan
olli
are you actually printing this? cout << "Books: " << books << endl << endl; cout << "Happy students: "; for (auto i = satisfied.begin(); i != satisfied.end(); i++) { cout << *i << " "; }
olli
For the constraints I used long long int in heap but still....
yeah, but try with 2 1 999999999 999999999 999999999
Roshan
It will hang my phone probably
Roshan
But it takes much time....
Георгий
Stop learninf fucking C
Roshan
Could you please make your own code and try it in Dcoder app
Roshan
I see many people in internet asking this same question but nobody has a perfect solution in c++
Roshan
Everyone getting 1/3 test cases correct 🙁
Георгий
Stop learninf fucking C
And coding on VS
Sai
How to split string and store them in an array.?
Roshan
String sth = "sth"; char x[3]; x[0] = sth[0]; (use loops) Similarly...
olli
Could you please make your own code and try it in Dcoder app
took a while to sign up... but looks like it worked ¯\_(ツ)_/¯
olli
But it takes much time....
exactly my point. A lot of sites "fail" if your code takes more than a second to execute
su
How to split string and store them in an array.?
just split it and store in an array
Mino
Hi everybody, Is there someone that could help me ? I don't know how can comment directly a code with C++ compiler online (which bottom on my keyboard). I don't want know how can do an comment, because I know (// or */ for multiple). But I want comment all code with something bottom in my keyboard for example I saw that more people use ALT+SHIFT+C but Doesn't work on my key ...
Mino
ok perfect resolved it
Mino
ctl+/
Manav
I've changed the code for simplicity please review if it will work for all test cases (That Love for Maths question)
You didn't even implement what I said, you're doing the same thing, finding maximum of the minimum values and minimum of the max value.
Roshan
And?
1/3 correct
Manav
1/3 correct
Do you understand what that problem is asking of you? If even one test case evaluates to false, your implementation or the algorithm is incorrect