Turmacs's Posts
Nairaland Forum › Turmacs's Profile › Turmacs's Posts
1 2 3 4 5 6 7 8 9 10 (of 24 pages)
Rubbish |
s |
If no solution till tommorow, then i'll drop the solution with explanations, goodnight. |
tensazangetsu20: ![]() |
Note This problem has to be solved in O(1) time. O(n) solutions or anything more than O(1) (constant time) will fail because n,a,b can be as large as 109. So if your solution is not O(1), it'll be too slow for large values of n. Problem statement tensazangetsu20 just launched his bread factory today and he baked n breads to sell. The usual price of a bread is a naira, but being his first day of business, tensazangetsu20 decided organize the following promotions: *tensa chooses some integer k (0 ≤ k ≤ min(a ,b)) *tensa sells his first k breads at a modified price. In this case, the price of the i'th (1 ≤ i ≤ k) sold bread is (b - i + 1) naira. *The remaining (n-k) breads are sold at the usual price of a naira each. Note that k can be equal to 0 and in that case, tensa will sell all his breads at a naira each. Your task is to help tensazangetsu20 find the maximum profit he can obtain by selling all n breads. Input The first line of the input contains a single integer t (1 ≤ t≤ 104) — the number of test cases. The only line of each test case contains three integers n, a, and b (1≤ n,a,b ≤ 109) — the number of breads, the usual price of a bread, and the price of the first bread to be sold at a modified price. Output For each test case, output one integer, the max profit tensazangetsu20 can generate. Example input 7 4 4 5 5 5 9 10 10 5 5 5 11 1000000000 1000000000 1000000000 1000000000 1000000000 1 1000 1 1000 output 17 35 100 45 1000000000000000000 1000000000000000000 500500 |
How old are you first? All these shameless men we have nowadays, some of them are not ashamed of saying that they still live as tenants at their age. Some of you are not ashamed of yourselves... Young boys of 23 years old that some of you know when they married their mothers are building houses, buying cars worth millions, owning multimillion naira businesses, have hundreds of millions sitting in their bank accounts, but some of you at your age are not ashamed to say that you still live in landlords house, i spit on your bald heads. The most annoying part is that instead of them to go and Hussle for money, na woman be their number one priority, stupid men everywhere. God please anything that will make me have anything to do with a broke man in rebuke it in the mighty name of jesus. |
9JAMac10:As in.. Na idiot's na him full this country i swear.. If na me be that guy, this we mark the end of my Nigerain football career.. I no fit dey represent such foolish people.. I go just go abroad where people get sense go raise my children and live my life. |
Paystack:Chai, I can feel the pain in your comment Pain kpai u there. |
Paystack:I don't blame your father... When it comes to anything that has to do with programming, math, logical thinking or problem solving in general, please leave it for people like us because me and you no be mate for this thing normally. You can stick to what your brain can carry, frontend,back-end, react, etc.... I don't code for daily bread like most of you, I code for fun, passion and for my love of math. Have a nice life. |
Shomek:It is your mother that is an ugly girl |
Shomek:Who's "us" ? Because last time I checked, I never mentioned your fathers name anywhere on the thread... I just posted the problem for anyone that would love to challenge themselves or likes leetcode style problems. If you can't or don't want to solve it then you move, abi what's your problem? ![]() |
Things like this mostly happens when you have stingy parents. Some parents prefer to impress outsiders with their money than to give their children. |
Shebi he knows that if the dog kills that man he's going to jail? ![]() |
![]() |
Check this problem...... Problem statement A sentien is a integer who's digits are all 1 in decimal representation. The sentiens in ascending are 1,11,111,........ and so on. Your task is to find the N'th smallest integer that can be represented as the sum of exactly three sentiens. Constraints N is an integer between 1 and 333, inclusive Input The only line of the input contains N. Output Output the N'th smallest integer that can be represented as the sum of three sentiens. Example Input 1 5 Output 1 113 The integers that can be represented as the sum of exactly three sentiens are 3,13,23,33,113,.... in ascending order. For example, you can express 113 as 113 = 1 + 1 + 111, you can express 3 as 3 = 1+1+1, you can express 13 as 13 = 1 + 1 + 11. Note that the three sentiens do not have to be different. Input 2 19 Output 2 2333 Input 3 333 Output 3 112222222233 |
For those that might be interested in how to think about the solution.... First of all you need to understand that this problem is not as mathematical as some might have thought, because I assumed that after reading the second paragraph some people who are not math inclined will lose hope, it's just pure implementation problem with very very little math, basically just addition and subtraction. I don't know what that MindHacker9009 guy is saying, university mathematics students Lolzz.. A child in jss1who knows how to code should be able to solve this with little effort.You have to observe that the points that are part of the circle are always in a diamond shape and are symmetrical from the middle column. All you have to do is to find the first appearance of '#' character because the first appearance will always be the on the same column as the center of the circle ( the row and column that it's found on) and to find the row that the center appears on, just count the number of '#' in the middle column, divide that count by 2 (to find the position of the middle) then add whatever you get to the row number that the first '#' was on. Sorry if my explanation is hard to understand by here is my C++ solution to the problem, you can use chatgpt to convert to any language of your choice to understand it.
|
MindHacker9009:Bro please keep quiet, you always talk reason like what i don't know. You could not solve it be say you could not solve it, this is a leetcode style problem so you're telling me it's university students that should be doing leetcode? Okay when you get to your next interview and they give you leetcode style problem, tell them that one. You will not waste time to solve a simple problem that would not take more than 15 LOC to solve, but you have time to type all this gibberish? Ohh please I've always known you to shy away from anything that has to do with any form of critical thinking so I'm not surprised here. The other day i posted a simple math problem, na still this you gibbering you use as excuse. |
Paystack:Look at this one Such a pained soul, all these self taught people sef. Before I posted the problem, i know I'll find dumb devs who can not solve the simple problem but will use "how much" as an excuse to escape reality. You're dumb be say you're dumb, all these long talk no necessary. |
![]() |
Mr Dangote, i just want to let you know that anyone of you so called "elites" that might have been involved in any sort of corruption for personal gain, at the detriment of the Nigerian populace, the consequences of those things will definitely catch up with you and others like you in the future. Even if you all have passed on by then, your relatives and all those that might have inherited those proceeds of corruption will face the consequences. One thing about corruption is that it has the tendency to consume itself. All you need are people that are willing to fight and have what it takes to fight the corrupt system, all that is left is to exploit the loopholes created by the system itself. |
Wait please who are you people asking all this king questions so? Is it the same Nigeria that 99.4% of all the bank accounts have less than 500k in them? na them una dey ask all these one's so? |
tosinhtml:Who is this DevDevDev abeg? the other guy say na TastedFriedPussy... Na wa ohh. |
PulsingPurple:Wow this is actually correct and I am really surprised that it could solve it (although this a very easy problem). Chatgpt just solved nonsense. So no software engineer on NL could solve this till now? wonderfull. |
airsaylongcome:Lolzzz.. Except your "LLM" or "AI" is better than chatgpt, i don't think it can solve this one because chatgpt could not solve it. No be by cho , cho , cho, show workings Post the solution here let us see it. |
RealLordZeus:na so, just say you can't solve it, nobody will mock you. |
You can attempt the problem with any language you are comfortable with. Problem statement you are given an n by m grid (n is the number of rows and m is the number of columns), the grid only contains just the characters '*' and '#', a whole manhattan circle exit's on the grid. The coordinates of the top left corner and bottom right corner of this grid are (1,1) and (n,m) respectively. The point (a,b) is a part of the manhattan circle which is centered at (h,k) if | h - a | + | k - b | < r , where r is a positive constant and | x - y | represents the absolute value of x - y. On this grid, all points that are a part of the manhattan circle are denoted by the '#' character. Your task is to find the coordinates of the circles center. Input The first line contains t ( 1 <= t <= 1000) --- The number of testcases. The first line of each testcase contain n and m (1 <= n *m <= 2*105) which both stand for the height and width of the grid respectively. The next n lines contain m characters that are either '.' or '#'. If the character is '#', then you know that the point is a part of the circle. Output For each t, your code has to print two integers, the coordinates of the circles center. Example Input 6 5 5 ***** ***** **#** ***** ***** 5 5 **#** *###* ##### *###* **#** 5 6 ****** ****** *#**** ###*** *#**** 1 1 # 5 6 ***#** **###* *##### **###* ***#** 2 10 ********** ***#****** Output 3 3 3 3 4 2 1 1 3 4 2 4 Let us see those that are real programmers ![]() nlfpmod mynd44 farano dominique, is this fun enough for front page? |
iLegendd:preach bro, preach!!!! |
itzzkhaliii:I know you will try to defend the indefensible and I'll not waste my time much with you. The model i bought had a fan in it( can't remembered the name because i sold it). The one you're even Selling doesn't even have a fan(you said it's chip) and I'm assuming you meant airjet tech from companies like frore systems. That one is even worse because that technology is in it's infancy and still not as efficient as the traditional fan system. With the specs of that laptop, it's bound to overheat. If you want to try me, install blender and try to render a simple low poly scene, the heat from that laptop go cook beans. I'm not your average tech savvy person and i know what I'm talking about. Even you wey dey sell system no know system reach me so rest. The people that you claimed you sold 10 units to most probably don't know what they're buying so I'm not surprised and you shouldn't even be bragging with that. |
itzzkhaliii:please nobody should buy this types of laptops. All these laptops with detachable screens. The screens are not durable at all, they easily get spoilt and the price to repair/replace them is something else. Not to even mention the heating issues, fan go dey sound like generator but still laptop go dey hot like hot plate. The heat causes the systems to hang alot and most programs crash abruptly. Talking from experience. |
you people should better go and be holding ADA(cardano), i don talk my own. I see an easy 2x loading. |
GovernmentAgent:Bro abeg go and sit down, bull run is over. I bought solana @ $20 last year with 500k and it's only me and my God that knows how much I'm sitting on. The people that are reaping profits this year are those that bought coins like solana last year that pumped into the New year. I remember when i made a post telling people to go and buy solana when it was still around 20, one mumu called me a goat here. if you used at least 1-2M to hold that coin till now, you for don buy the GLK this year.
|
This one una just dey see snakes everywhere. They be looking like all these possessed Nigerian |
All these shameless men we have nowadays, some of them are not ashamed of saying that they still live as tenants at their age. Some of you are not ashamed of yourselves... Young boys of 23 years old that some of you know when they married their mothers are building houses, buying cars worth millions, owning multimillion naira businesses, have hundreds of millions sitting in their bank accounts, but some of you at your age are not ashamed to say that you still live in landlords house, i spit on your bald heads. The most annoying part is that instead of them to go and Hussle for money, na woman be their number one priority, stupid men everywhere. God please anything that will make me have anything to do with a broke man in rebuke it in the mighty name of jesus.
