filmov
tv
Richie Rich (CHFRICH) CodeChef Complete C++ solution - June Lunch time 2021 - cpp programming

Показать описание
Richie Rich (CHFRICH)
Problem link :
DSA Course link:
Hi, thanks for watching our video about Arrays in C++
In this video we’ll walk you through:
- simple maths
- solved the problem live
- Solution
TIMESTAMPS
0:00 Intro
1:40 Explanation begins
08:25 IDE solution
ABOUT OUR CHANNEL
Our channel is all about Programming. We cover lots of cool stuff such as solution to problems, concept explanation and tricks to master CP
Check out our channel here:
Don’t forget to subscribe!
CHECK OUT OUR OTHER Playlists
GeeksforGeeks playlist:
Complete C++ Course playlist:
CodeChef Playlist:
LeetCode problems
HackerRank playlist:
FIND US AT
GET IN TOUCH
Chef aims to be the richest person in Chefland by his new restaurant franchise. Currently, his assets are worth A billion dollars and have no liabilities. He aims to increase his assets by X billion dollars per year.
Also, all the richest people in Chefland are not planning to grow and maintain their current worth.
To be the richest person in Chefland, he needs to be worth at least B billion dollars. How many years will it take Chef to reach his goal if his value increases by X billion dollars each year?
Input
The first line contains an integer T, the number of test cases. Then the test cases follow.
Each test case contains a single line of input, three integers A, B, X.
Output
For each test case, output in a single line the answer to the problem.
Constraints
1 ≤ T ≤ 21 000
100 ≤ A less than B ≤ 200
1 ≤ X ≤ 50
X divides B − A
Subtasks
Subtask #1 (100 points): Original constraints
Sample Input
3
100 200 10
111 199 11
190 200 10
Sample Output
10
8
1
Explanation
Test Case 1: Chef needs to increase his worth by 200−100=100 billion dollars and his increment per year being 10 billion dollars, so it will take him 10010=10 years to do so.
Test Case 2: Chef needs to increase his worth by 199−111=88 billion dollars and his increment per year being 11 billion dollars, so it will take him 8811=8 years to do so.
Test Case 3: Chef needs to increase his worth by 200−190=10 billion dollars and his increment per year being 10 billion dollars, so it will take him 1010=1 year to do so.
All submissions for this problem are available.
Author: daanish_adm
Tags: cakewalk, daanish_adm, ltime97, math
Update this setting in edit profile
Date Added: 10-06-2021
Time Limit: 0.5 secs
Source Limit: 50000 Bytes
Languages: CPP14, C, JAVA, PYTH 3.6, CPP17, PYTH, PYP3, CS2, ADA, PYPY, TEXT, PAS fpc, NODEJS, RUBY, PHP, GO, HASK, TCL, PERL, SCALA, LUA, kotlin, BASH, JS, LISP sbcl, rust, PAS gpc, BF, CLOJ, R, D, CAML, FORT, ASM, swift, FS, WSPC, LISP clisp, SQL, SCM guile, PERL6, ERL, CLPS, ICK, NICE, PRLG, ICON, COB, SCM chicken, PIKE, SCM qobi, ST, SQLQ, NEM
Submit (Practice)
Problem link :
DSA Course link:
Hi, thanks for watching our video about Arrays in C++
In this video we’ll walk you through:
- simple maths
- solved the problem live
- Solution
TIMESTAMPS
0:00 Intro
1:40 Explanation begins
08:25 IDE solution
ABOUT OUR CHANNEL
Our channel is all about Programming. We cover lots of cool stuff such as solution to problems, concept explanation and tricks to master CP
Check out our channel here:
Don’t forget to subscribe!
CHECK OUT OUR OTHER Playlists
GeeksforGeeks playlist:
Complete C++ Course playlist:
CodeChef Playlist:
LeetCode problems
HackerRank playlist:
FIND US AT
GET IN TOUCH
Chef aims to be the richest person in Chefland by his new restaurant franchise. Currently, his assets are worth A billion dollars and have no liabilities. He aims to increase his assets by X billion dollars per year.
Also, all the richest people in Chefland are not planning to grow and maintain their current worth.
To be the richest person in Chefland, he needs to be worth at least B billion dollars. How many years will it take Chef to reach his goal if his value increases by X billion dollars each year?
Input
The first line contains an integer T, the number of test cases. Then the test cases follow.
Each test case contains a single line of input, three integers A, B, X.
Output
For each test case, output in a single line the answer to the problem.
Constraints
1 ≤ T ≤ 21 000
100 ≤ A less than B ≤ 200
1 ≤ X ≤ 50
X divides B − A
Subtasks
Subtask #1 (100 points): Original constraints
Sample Input
3
100 200 10
111 199 11
190 200 10
Sample Output
10
8
1
Explanation
Test Case 1: Chef needs to increase his worth by 200−100=100 billion dollars and his increment per year being 10 billion dollars, so it will take him 10010=10 years to do so.
Test Case 2: Chef needs to increase his worth by 199−111=88 billion dollars and his increment per year being 11 billion dollars, so it will take him 8811=8 years to do so.
Test Case 3: Chef needs to increase his worth by 200−190=10 billion dollars and his increment per year being 10 billion dollars, so it will take him 1010=1 year to do so.
All submissions for this problem are available.
Author: daanish_adm
Tags: cakewalk, daanish_adm, ltime97, math
Update this setting in edit profile
Date Added: 10-06-2021
Time Limit: 0.5 secs
Source Limit: 50000 Bytes
Languages: CPP14, C, JAVA, PYTH 3.6, CPP17, PYTH, PYP3, CS2, ADA, PYPY, TEXT, PAS fpc, NODEJS, RUBY, PHP, GO, HASK, TCL, PERL, SCALA, LUA, kotlin, BASH, JS, LISP sbcl, rust, PAS gpc, BF, CLOJ, R, D, CAML, FORT, ASM, swift, FS, WSPC, LISP clisp, SQL, SCM guile, PERL6, ERL, CLPS, ICK, NICE, PRLG, ICON, COB, SCM chicken, PIKE, SCM qobi, ST, SQLQ, NEM
Submit (Practice)