From 3a89fc707253f75f46fd5a4822817f1fd5156c40 Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Mon, 30 May 2022 00:18:17 +0200 Subject: Made that every problem is its own folder to make building the code a smooth operation with a shortcut --- AvtoBus.cpp | 16 ------ AvtoBus/AvtoBus.cpp | 16 ++++++ BoyOrGirl.cpp | 12 ---- BoyOrGirl/BoyOrGirl.cpp | 12 ++++ CamelCase.cpp | 16 ------ CamelCase/CamelCase.cpp | 16 ++++++ ConsecutivePointsSegment.cpp | 31 ---------- .../ConsecutivePointsSegment.cpp | 31 ++++++++++ CountingSort1.cpp | 19 ------- CountingSort1/CountingSort1.cpp | 19 +++++++ CountingSort2.cpp | 21 ------- CountingSort2/CountingSort2.cpp | 21 +++++++ Diagonal_Difference.cpp | 30 ---------- Diagonal_Difference/Diagonal_Difference.cpp | 30 ++++++++++ Dictionary.cpp | 22 ------- Dictionary/Dictionary.cpp | 22 +++++++ DiffucltyRatingOrder.cpp | 23 -------- DiffucltyRatingOrder/DiffucltyRatingOrder.cpp | 23 ++++++++ DormsRoom.cpp | 30 ---------- DormsRoom/DormsRoom.cpp | 30 ++++++++++ Equalize_the_array.cpp | 19 ------- Equalize_the_array/Equalize_the_array.cpp | 19 +++++++ EvenAndOdd.cpp | 25 -------- EvenAndOdd/EvenAndOdd.cpp | 25 ++++++++ FallDown.cpp | 36 ------------ FallDown/FallDown.cpp | 36 ++++++++++++ Flipping_bits.cpp | 16 ------ Flipping_bits/Flipping_bits.cpp | 16 ++++++ Football.cpp | 18 ------ Football/Football.cpp | 18 ++++++ HelpfulMaths.cpp | 24 -------- HelpfulMaths/HelpfulMaths.cpp | 24 ++++++++ InfiniteReplacement.cpp | 26 --------- InfiniteReplacement/InfiniteReplacement.cpp | 26 +++++++++ InfinityStaircase.cpp | 24 -------- InfinityStaircase/InfinityStaircase.cpp | 24 ++++++++ LisaWorkbook.cpp | 25 -------- LisaWorkbook/LisaWorkbook.cpp | 25 ++++++++ LonelyInteger.cpp | 12 ---- LonelyInteger/LonelyInteger.cpp | 12 ++++ Luck_balance.cpp | 37 ------------ Luck_balance/Luck_balance.cpp | 37 ++++++++++++ MakeItIncreasing.cpp | 24 -------- MakeItIncreasing/MakeItIncreasing.cpp | 24 ++++++++ MarcCakwalk.cpp | 18 ------ MarcCakwalk/MarcCakwalk.cpp | 18 ++++++ MaximizingXOR.cpp | 17 ------ MaximizingXOR/MaximizingXOR.cpp | 17 ++++++ MinDiffInArray.cpp | 19 ------- MinDiffInArray/MinDiffInArray.cpp | 19 +++++++ NumberTransformation.cpp | 31 ---------- NumberTransformation/NumberTransformation.cpp | 31 ++++++++++ Odd-EvenIncrements.cpp | 59 ------------------- Odd-EvenIncrements/Odd-EvenIncrements.cpp | 59 +++++++++++++++++++ PerfectlyBalancedString.cpp | 33 ----------- .../PerfectlyBalancedString.cpp | 33 +++++++++++ PrimeOrNot.cpp | 16 ------ PrimeOrNot/PrimeOrNot.cpp | 16 ++++++ SequenceEquation.cpp | 25 -------- SequenceEquation/SequenceEquation.cpp | 25 ++++++++ StringTask.cpp | 20 ------- StringTask/StringTask.cpp | 20 +++++++ SumsOfSubSequence.cpp | 14 ----- SumsOfSubSequence/SumsOfSubSequence.cpp | 14 +++++ TakeDiscountOrNot.cpp | 18 ------ TakeDiscountOrNot/TakeDiscountOrNot.cpp | 18 ++++++ ThePowerSum.cpp | 36 ------------ ThePowerSum/ThePowerSum.cpp | 36 ++++++++++++ TokitsukazeAndAllZeroSequence.cpp | 38 ------------- .../TokitsukazeAndAllZeroSequence.cpp | 38 +++++++++++++ YoungPhysicist.cpp | 22 ------- YoungPhysicist/YoungPhysicist.cpp | 22 +++++++ chocolateFeast.cpp | 43 -------------- chocolateFeast/chocolateFeast.cpp | 43 ++++++++++++++ chocolateFeastRevised.cpp | 19 ------- chocolateFeastRevised/chocolateFeastRevised.cpp | 19 +++++++ codechef/aSubtaskProblem.cpp | 32 ----------- codechef/aSubtaskProblem/aSubtaskProblem.cpp | 32 +++++++++++ codechef/chefAndIpcCertificates.cpp | 22 ------- .../chefAndIpcCertificates.cpp | 22 +++++++ codechef/chefAndSpells.cpp | 16 ------ codechef/chefAndSpells/chefAndSpells.cpp | 16 ++++++ codechef/chefAndStockPrices.cpp | 16 ------ codechef/chefAndStockPrices/chefAndStockPrices.cpp | 16 ++++++ codechef/chefInVaccinationQueue.cpp | 26 --------- .../chefInVaccinationQueue.cpp | 26 +++++++++ codechef/cleanup.sh | 11 ++++ codechef/distinctPairSums.cpp | 16 ------ codechef/distinctPairSums/distinctPairSums.cpp | 16 ++++++ codechef/firstAndLastDigit.cpp | 19 ------- codechef/firstAndLastDigit/firstAndLastDigit.cpp | 19 +++++++ codechef/gasolineIntroudution.cpp | 29 ---------- .../gasolineIntroudution/gasolineIntroudution.cpp | 29 ++++++++++ codechef/hardCash/hardCash.cpp | 14 +++++ codechef/hoopJump.cpp | 15 ----- codechef/hoopJump/hoopJump.cpp | 15 +++++ codechef/icpcBallons.cpp | 23 -------- codechef/icpcBallons/icpcBallons.cpp | 23 ++++++++ codechef/luckyFour.cpp | 22 ------- codechef/luckyFour/luckyFour.cpp | 22 +++++++ codechef/makeThemEqual.cpp | 22 ------- codechef/makeThemEqual/makeThemEqual.cpp | 22 +++++++ codechef/maximumLengthEvenSubarray.cpp | 27 --------- .../maximumLengthEvenSubarray.cpp | 27 +++++++++ codechef/motivations.cpp | 23 -------- codechef/motivations/motivations.cpp | 23 ++++++++ codechef/problemCategory.cpp | 23 -------- codechef/problemCategory/problemCategory.cpp | 23 ++++++++ codechef/programmingLanguages.cpp | 29 ---------- .../programmingLanguages/programmingLanguages.cpp | 29 ++++++++++ codechef/reverseTheNumber.cpp | 25 -------- codechef/reverseTheNumber/reverseTheNumber.cpp | 25 ++++++++ codechef/richieRich.cpp | 15 ----- codechef/richieRich/richieRich.cpp | 15 +++++ codechef/smallestPossibleWholeNumber.cpp | 19 ------- .../smallestPossibleWholeNumber.cpp | 19 +++++++ codechef/sumOfDigits.cpp | 20 ------- codechef/sumOfDigits/sumOfDigits.cpp | 20 +++++++ codechef/theTwoDishes.cpp | 15 ----- codechef/theTwoDishes/theTwoDishes.cpp | 15 +++++ codechef/tomAndJerry.cpp | 22 ------- codechef/tomAndJerry/tomAndJerry.cpp | 22 +++++++ codechef/turnIt.cpp | 16 ------ codechef/turnIt/turnIt.cpp | 16 ++++++ codechef/twoDishes.cpp | 15 ----- codechef/twoDishes/twoDishes.cpp | 15 +++++ codechef/vaccineDates.cpp | 23 -------- codechef/vaccineDates/vaccineDates.cpp | 23 ++++++++ codechef/validTriangles.cpp | 15 ----- codechef/validTriangles/validTriangles.cpp | 15 +++++ codechef/weightBalance.cpp | 21 ------- codechef/weightBalance/weightBalance.cpp | 21 +++++++ contests/05-05-2022(Div.3)/A/A | Bin 17848 -> 679 bytes contests/05-05-2022(Div.3)/A/A.cpp | 42 -------------- contests/05-05-2022(Div.3)/B/B | Bin 33024 -> 808 bytes contests/05-05-2022(Div.3)/B/B.cpp | 48 ---------------- contests/05-05-2022(Div.3)/C/C.cpp | 1 - contests/05-05-2022(Div.3)/C/C/C.cpp | 1 + contests/05-05-2022(Div.3)/D/D.cpp | 0 contests/05-05-2022(Div.3)/D/D/D.cpp | 0 contests/05-05-2022(Div.3)/E/E.cpp | 0 contests/05-05-2022(Div.3)/E/E/E.cpp | 0 contests/05-05-2022(Div.3)/F/F.cpp | 0 contests/05-05-2022(Div.3)/F/F/F.cpp | 0 contests/08-03-2022(Div.3)/A | Bin 18880 -> 451 bytes contests/08-03-2022(Div.3)/A.cpp | 25 -------- .../A_Deletions_of_Two_Adjacent_Letters | Bin 18664 -> 722 bytes .../A_Deletions_of_Two_Adjacent_Letters.cpp | 37 ------------ contests/08-03-2022(Div.3)/B | Bin 17688 -> 410 bytes contests/08-03-2022(Div.3)/B.cpp | 23 -------- contests/08-03-2022(Div.3)/B_DIV_MOD.cpp | 23 -------- contests/08-03-2022(Div.3)/B_DIV_MOD/B_DIV_MOD.cpp | 23 ++++++++ contests/08-03-2022(Div.3)/C.cpp | 22 ------- contests/08-03-2022(Div.3)/C/C.cpp | 22 +++++++ contests/08-03-2022(Div.3)/D.cpp | 20 ------- contests/08-03-2022(Div.3)/D/D.cpp | 20 +++++++ contests/08-03-2022(Div.3)/E.cpp | 9 --- contests/08-03-2022(Div.3)/E/E.cpp | 9 +++ contests/21-04-2022(Div.4)/A | Bin 17792 -> 391 bytes contests/21-04-2022(Div.4)/A.cpp | 23 -------- contests/21-04-2022(Div.4)/B | Bin 47400 -> 454 bytes contests/21-04-2022(Div.4)/B.cpp | 30 ---------- contests/21-04-2022(Div.4)/E | Bin 24728 -> 448 bytes contests/21-04-2022(Div.4)/E.cpp | 25 -------- contests/21-04-2022(Div.4)/F | Bin 22712 -> 62 bytes contests/21-04-2022(Div.4)/F.cpp | 7 --- contests/Round#788/A(2_pointers).cpp | 29 ---------- contests/Round#788/A(2_pointers)/A(2_pointers).cpp | 29 ++++++++++ contests/Round#788/A.cpp | 50 ---------------- contests/Round#788/A/A.cpp | 50 ++++++++++++++++ contests/Round#788/B.cpp | 7 --- contests/Round#788/B/B.cpp | 7 +++ contests/Round#788/C.cpp | 7 --- contests/Round#788/C/C.cpp | 7 +++ contests/Round#788/D.cpp | 7 --- contests/Round#788/D/D.cpp | 7 +++ contests/Round#788/E.cpp | 7 --- contests/Round#788/E/E.cpp | 7 +++ contests/Round#788/F.cpp | 7 --- contests/Round#788/F/F.cpp | 7 +++ contests/Round#790/10-10-2022(Div4)/B.cpp | 25 -------- contests/Round#790/10-10-2022(Div4)/B/B.cpp | 25 ++++++++ contests/Round#790/10-10-2022(Div4)/C.cpp | 28 --------- contests/Round#790/10-10-2022(Div4)/C/C.cpp | 28 +++++++++ contests/Round#790/10-10-2022(Div4)/D.cpp | 51 ----------------- contests/Round#790/10-10-2022(Div4)/D/D.cpp | 51 +++++++++++++++++ cutTheSticks.cpp | 63 --------------------- cutTheSticks/cutTheSticks.cpp | 63 +++++++++++++++++++++ cutTheSticksJoe.cpp | 21 ------- cutTheSticksJoe/cutTheSticksJoe.cpp | 21 +++++++ cutTheSticksRevised.cpp | 10 ---- cutTheSticksRevised/cutTheSticksRevised.cpp | 10 ++++ iceCreamParlor.cpp | 38 ------------- iceCreamParlor/iceCreamParlor.cpp | 38 +++++++++++++ recursionTest.cpp | 51 ----------------- recursionTest/recursionTest.cpp | 51 +++++++++++++++++ 196 files changed, 2001 insertions(+), 2236 deletions(-) delete mode 100644 AvtoBus.cpp create mode 100644 AvtoBus/AvtoBus.cpp delete mode 100644 BoyOrGirl.cpp create mode 100644 BoyOrGirl/BoyOrGirl.cpp delete mode 100644 CamelCase.cpp create mode 100644 CamelCase/CamelCase.cpp delete mode 100644 ConsecutivePointsSegment.cpp create mode 100644 ConsecutivePointsSegment/ConsecutivePointsSegment.cpp delete mode 100644 CountingSort1.cpp create mode 100644 CountingSort1/CountingSort1.cpp delete mode 100644 CountingSort2.cpp create mode 100644 CountingSort2/CountingSort2.cpp delete mode 100644 Diagonal_Difference.cpp create mode 100644 Diagonal_Difference/Diagonal_Difference.cpp delete mode 100644 Dictionary.cpp create mode 100644 Dictionary/Dictionary.cpp delete mode 100644 DiffucltyRatingOrder.cpp create mode 100644 DiffucltyRatingOrder/DiffucltyRatingOrder.cpp delete mode 100644 DormsRoom.cpp create mode 100644 DormsRoom/DormsRoom.cpp delete mode 100644 Equalize_the_array.cpp create mode 100644 Equalize_the_array/Equalize_the_array.cpp delete mode 100644 EvenAndOdd.cpp create mode 100644 EvenAndOdd/EvenAndOdd.cpp delete mode 100644 FallDown.cpp create mode 100644 FallDown/FallDown.cpp delete mode 100644 Flipping_bits.cpp create mode 100644 Flipping_bits/Flipping_bits.cpp delete mode 100644 Football.cpp create mode 100644 Football/Football.cpp delete mode 100644 HelpfulMaths.cpp create mode 100644 HelpfulMaths/HelpfulMaths.cpp delete mode 100644 InfiniteReplacement.cpp create mode 100644 InfiniteReplacement/InfiniteReplacement.cpp delete mode 100644 InfinityStaircase.cpp create mode 100644 InfinityStaircase/InfinityStaircase.cpp delete mode 100644 LisaWorkbook.cpp create mode 100644 LisaWorkbook/LisaWorkbook.cpp delete mode 100644 LonelyInteger.cpp create mode 100644 LonelyInteger/LonelyInteger.cpp delete mode 100644 Luck_balance.cpp create mode 100644 Luck_balance/Luck_balance.cpp delete mode 100644 MakeItIncreasing.cpp create mode 100644 MakeItIncreasing/MakeItIncreasing.cpp delete mode 100644 MarcCakwalk.cpp create mode 100644 MarcCakwalk/MarcCakwalk.cpp delete mode 100644 MaximizingXOR.cpp create mode 100644 MaximizingXOR/MaximizingXOR.cpp delete mode 100644 MinDiffInArray.cpp create mode 100644 MinDiffInArray/MinDiffInArray.cpp delete mode 100644 NumberTransformation.cpp create mode 100644 NumberTransformation/NumberTransformation.cpp delete mode 100644 Odd-EvenIncrements.cpp create mode 100644 Odd-EvenIncrements/Odd-EvenIncrements.cpp delete mode 100644 PerfectlyBalancedString.cpp create mode 100644 PerfectlyBalancedString/PerfectlyBalancedString.cpp delete mode 100644 PrimeOrNot.cpp create mode 100644 PrimeOrNot/PrimeOrNot.cpp delete mode 100644 SequenceEquation.cpp create mode 100644 SequenceEquation/SequenceEquation.cpp delete mode 100644 StringTask.cpp create mode 100644 StringTask/StringTask.cpp delete mode 100644 SumsOfSubSequence.cpp create mode 100644 SumsOfSubSequence/SumsOfSubSequence.cpp delete mode 100644 TakeDiscountOrNot.cpp create mode 100644 TakeDiscountOrNot/TakeDiscountOrNot.cpp delete mode 100644 ThePowerSum.cpp create mode 100644 ThePowerSum/ThePowerSum.cpp delete mode 100644 TokitsukazeAndAllZeroSequence.cpp create mode 100644 TokitsukazeAndAllZeroSequence/TokitsukazeAndAllZeroSequence.cpp delete mode 100644 YoungPhysicist.cpp create mode 100644 YoungPhysicist/YoungPhysicist.cpp delete mode 100644 chocolateFeast.cpp create mode 100644 chocolateFeast/chocolateFeast.cpp delete mode 100644 chocolateFeastRevised.cpp create mode 100644 chocolateFeastRevised/chocolateFeastRevised.cpp delete mode 100644 codechef/aSubtaskProblem.cpp create mode 100644 codechef/aSubtaskProblem/aSubtaskProblem.cpp delete mode 100644 codechef/chefAndIpcCertificates.cpp create mode 100644 codechef/chefAndIpcCertificates/chefAndIpcCertificates.cpp delete mode 100644 codechef/chefAndSpells.cpp create mode 100644 codechef/chefAndSpells/chefAndSpells.cpp delete mode 100644 codechef/chefAndStockPrices.cpp create mode 100644 codechef/chefAndStockPrices/chefAndStockPrices.cpp delete mode 100644 codechef/chefInVaccinationQueue.cpp create mode 100644 codechef/chefInVaccinationQueue/chefInVaccinationQueue.cpp create mode 100755 codechef/cleanup.sh delete mode 100644 codechef/distinctPairSums.cpp create mode 100644 codechef/distinctPairSums/distinctPairSums.cpp delete mode 100644 codechef/firstAndLastDigit.cpp create mode 100644 codechef/firstAndLastDigit/firstAndLastDigit.cpp delete mode 100644 codechef/gasolineIntroudution.cpp create mode 100644 codechef/gasolineIntroudution/gasolineIntroudution.cpp create mode 100644 codechef/hardCash/hardCash.cpp delete mode 100644 codechef/hoopJump.cpp create mode 100644 codechef/hoopJump/hoopJump.cpp delete mode 100644 codechef/icpcBallons.cpp create mode 100644 codechef/icpcBallons/icpcBallons.cpp delete mode 100644 codechef/luckyFour.cpp create mode 100644 codechef/luckyFour/luckyFour.cpp delete mode 100644 codechef/makeThemEqual.cpp create mode 100644 codechef/makeThemEqual/makeThemEqual.cpp delete mode 100644 codechef/maximumLengthEvenSubarray.cpp create mode 100644 codechef/maximumLengthEvenSubarray/maximumLengthEvenSubarray.cpp delete mode 100644 codechef/motivations.cpp create mode 100644 codechef/motivations/motivations.cpp delete mode 100644 codechef/problemCategory.cpp create mode 100644 codechef/problemCategory/problemCategory.cpp delete mode 100644 codechef/programmingLanguages.cpp create mode 100644 codechef/programmingLanguages/programmingLanguages.cpp delete mode 100644 codechef/reverseTheNumber.cpp create mode 100644 codechef/reverseTheNumber/reverseTheNumber.cpp delete mode 100644 codechef/richieRich.cpp create mode 100644 codechef/richieRich/richieRich.cpp delete mode 100644 codechef/smallestPossibleWholeNumber.cpp create mode 100644 codechef/smallestPossibleWholeNumber/smallestPossibleWholeNumber.cpp delete mode 100644 codechef/sumOfDigits.cpp create mode 100644 codechef/sumOfDigits/sumOfDigits.cpp delete mode 100644 codechef/theTwoDishes.cpp create mode 100644 codechef/theTwoDishes/theTwoDishes.cpp delete mode 100644 codechef/tomAndJerry.cpp create mode 100644 codechef/tomAndJerry/tomAndJerry.cpp delete mode 100644 codechef/turnIt.cpp create mode 100644 codechef/turnIt/turnIt.cpp delete mode 100644 codechef/twoDishes.cpp create mode 100644 codechef/twoDishes/twoDishes.cpp delete mode 100644 codechef/vaccineDates.cpp create mode 100644 codechef/vaccineDates/vaccineDates.cpp delete mode 100644 codechef/validTriangles.cpp create mode 100644 codechef/validTriangles/validTriangles.cpp delete mode 100644 codechef/weightBalance.cpp create mode 100644 codechef/weightBalance/weightBalance.cpp mode change 100755 => 100644 contests/05-05-2022(Div.3)/A/A delete mode 100644 contests/05-05-2022(Div.3)/A/A.cpp mode change 100755 => 100644 contests/05-05-2022(Div.3)/B/B delete mode 100644 contests/05-05-2022(Div.3)/B/B.cpp delete mode 100644 contests/05-05-2022(Div.3)/C/C.cpp create mode 100644 contests/05-05-2022(Div.3)/C/C/C.cpp delete mode 100644 contests/05-05-2022(Div.3)/D/D.cpp create mode 100644 contests/05-05-2022(Div.3)/D/D/D.cpp delete mode 100644 contests/05-05-2022(Div.3)/E/E.cpp create mode 100644 contests/05-05-2022(Div.3)/E/E/E.cpp delete mode 100644 contests/05-05-2022(Div.3)/F/F.cpp create mode 100644 contests/05-05-2022(Div.3)/F/F/F.cpp mode change 100755 => 100644 contests/08-03-2022(Div.3)/A delete mode 100644 contests/08-03-2022(Div.3)/A.cpp mode change 100755 => 100644 contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters delete mode 100644 contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp mode change 100755 => 100644 contests/08-03-2022(Div.3)/B delete mode 100644 contests/08-03-2022(Div.3)/B.cpp delete mode 100644 contests/08-03-2022(Div.3)/B_DIV_MOD.cpp create mode 100644 contests/08-03-2022(Div.3)/B_DIV_MOD/B_DIV_MOD.cpp delete mode 100644 contests/08-03-2022(Div.3)/C.cpp create mode 100644 contests/08-03-2022(Div.3)/C/C.cpp delete mode 100644 contests/08-03-2022(Div.3)/D.cpp create mode 100644 contests/08-03-2022(Div.3)/D/D.cpp delete mode 100644 contests/08-03-2022(Div.3)/E.cpp create mode 100644 contests/08-03-2022(Div.3)/E/E.cpp mode change 100755 => 100644 contests/21-04-2022(Div.4)/A delete mode 100644 contests/21-04-2022(Div.4)/A.cpp mode change 100755 => 100644 contests/21-04-2022(Div.4)/B delete mode 100644 contests/21-04-2022(Div.4)/B.cpp mode change 100755 => 100644 contests/21-04-2022(Div.4)/E delete mode 100644 contests/21-04-2022(Div.4)/E.cpp mode change 100755 => 100644 contests/21-04-2022(Div.4)/F delete mode 100644 contests/21-04-2022(Div.4)/F.cpp delete mode 100644 contests/Round#788/A(2_pointers).cpp create mode 100644 contests/Round#788/A(2_pointers)/A(2_pointers).cpp delete mode 100644 contests/Round#788/A.cpp create mode 100644 contests/Round#788/A/A.cpp delete mode 100644 contests/Round#788/B.cpp create mode 100644 contests/Round#788/B/B.cpp delete mode 100644 contests/Round#788/C.cpp create mode 100644 contests/Round#788/C/C.cpp delete mode 100644 contests/Round#788/D.cpp create mode 100644 contests/Round#788/D/D.cpp delete mode 100644 contests/Round#788/E.cpp create mode 100644 contests/Round#788/E/E.cpp delete mode 100644 contests/Round#788/F.cpp create mode 100644 contests/Round#788/F/F.cpp delete mode 100644 contests/Round#790/10-10-2022(Div4)/B.cpp create mode 100644 contests/Round#790/10-10-2022(Div4)/B/B.cpp delete mode 100644 contests/Round#790/10-10-2022(Div4)/C.cpp create mode 100644 contests/Round#790/10-10-2022(Div4)/C/C.cpp delete mode 100644 contests/Round#790/10-10-2022(Div4)/D.cpp create mode 100644 contests/Round#790/10-10-2022(Div4)/D/D.cpp delete mode 100644 cutTheSticks.cpp create mode 100644 cutTheSticks/cutTheSticks.cpp delete mode 100644 cutTheSticksJoe.cpp create mode 100644 cutTheSticksJoe/cutTheSticksJoe.cpp delete mode 100644 cutTheSticksRevised.cpp create mode 100644 cutTheSticksRevised/cutTheSticksRevised.cpp delete mode 100644 iceCreamParlor.cpp create mode 100644 iceCreamParlor/iceCreamParlor.cpp delete mode 100644 recursionTest.cpp create mode 100644 recursionTest/recursionTest.cpp diff --git a/AvtoBus.cpp b/AvtoBus.cpp deleted file mode 100644 index 615b1e7..0000000 --- a/AvtoBus.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; -int main() { - int tt; - cin >> tt; - while(tt--) { - long long x; - cin >> x; - vector v; - if(x % 2 != 0 || x == 2) { - cout << "-1" << endl; - continue; - } - cout << ((x + 5) / 6) << " " << x / 4 << endl; - } -} diff --git a/AvtoBus/AvtoBus.cpp b/AvtoBus/AvtoBus.cpp new file mode 100644 index 0000000..615b1e7 --- /dev/null +++ b/AvtoBus/AvtoBus.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; +int main() { + int tt; + cin >> tt; + while(tt--) { + long long x; + cin >> x; + vector v; + if(x % 2 != 0 || x == 2) { + cout << "-1" << endl; + continue; + } + cout << ((x + 5) / 6) << " " << x / 4 << endl; + } +} diff --git a/BoyOrGirl.cpp b/BoyOrGirl.cpp deleted file mode 100644 index 1ce7fff..0000000 --- a/BoyOrGirl.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using namespace std; -int main() { - string s; - cin >> s; - set st; - for(auto ch : s) { - st.insert(ch); - } - cout << (st.size() % 2 != 0 ? "IGNORE HIM!" : "CHAT WITH HER!") << endl; -} - diff --git a/BoyOrGirl/BoyOrGirl.cpp b/BoyOrGirl/BoyOrGirl.cpp new file mode 100644 index 0000000..1ce7fff --- /dev/null +++ b/BoyOrGirl/BoyOrGirl.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; +int main() { + string s; + cin >> s; + set st; + for(auto ch : s) { + st.insert(ch); + } + cout << (st.size() % 2 != 0 ? "IGNORE HIM!" : "CHAT WITH HER!") << endl; +} + diff --git a/CamelCase.cpp b/CamelCase.cpp deleted file mode 100644 index bbcef3a..0000000 --- a/CamelCase.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() { - string s; - int count = 0; - cin >> s; - for(auto ch : s) { - if(isupper(ch)) { - count++; - } - } - cout << count + 1 << '\n'; - return 0; -} diff --git a/CamelCase/CamelCase.cpp b/CamelCase/CamelCase.cpp new file mode 100644 index 0000000..bbcef3a --- /dev/null +++ b/CamelCase/CamelCase.cpp @@ -0,0 +1,16 @@ +#include + +using namespace std; + +int main() { + string s; + int count = 0; + cin >> s; + for(auto ch : s) { + if(isupper(ch)) { + count++; + } + } + cout << count + 1 << '\n'; + return 0; +} diff --git a/ConsecutivePointsSegment.cpp b/ConsecutivePointsSegment.cpp deleted file mode 100644 index f0d2b4c..0000000 --- a/ConsecutivePointsSegment.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; - int gapSize = 0; - int gap = 0; - cin >> n; - vector v(n); - for(int& x : v) cin >> x; - for(int i = 0; i < n - 1; i++) { - if(v[i+1] - v[i] > 1) { - gapSize += v[i+1] - v[i]; - gap++; - } - } - if(gap > 2) { - cout << "NO" << endl; - } else { - if(gapSize >= 5 && gap == 2) { - cout << "NO" << endl; - } else if(gap == 1 && gapSize >= 4){ - cout << "NO" << endl; - } else { - cout << "YES" << endl; - } - } - } -} diff --git a/ConsecutivePointsSegment/ConsecutivePointsSegment.cpp b/ConsecutivePointsSegment/ConsecutivePointsSegment.cpp new file mode 100644 index 0000000..f0d2b4c --- /dev/null +++ b/ConsecutivePointsSegment/ConsecutivePointsSegment.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; + int gapSize = 0; + int gap = 0; + cin >> n; + vector v(n); + for(int& x : v) cin >> x; + for(int i = 0; i < n - 1; i++) { + if(v[i+1] - v[i] > 1) { + gapSize += v[i+1] - v[i]; + gap++; + } + } + if(gap > 2) { + cout << "NO" << endl; + } else { + if(gapSize >= 5 && gap == 2) { + cout << "NO" << endl; + } else if(gap == 1 && gapSize >= 4){ + cout << "NO" << endl; + } else { + cout << "YES" << endl; + } + } + } +} diff --git a/CountingSort1.cpp b/CountingSort1.cpp deleted file mode 100644 index 20b476a..0000000 --- a/CountingSort1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using namespace std; - -int main() { - int n, x; - cin >> n; - vector v; - vector freq(100); - for(int i = 0; i < n; i ++){ - cin >> x; - freq[x]+=1; - } - for(auto m : freq){ - cout << m << " "; - } - cout << endl; - return 0; -} diff --git a/CountingSort1/CountingSort1.cpp b/CountingSort1/CountingSort1.cpp new file mode 100644 index 0000000..20b476a --- /dev/null +++ b/CountingSort1/CountingSort1.cpp @@ -0,0 +1,19 @@ +#include + +using namespace std; + +int main() { + int n, x; + cin >> n; + vector v; + vector freq(100); + for(int i = 0; i < n; i ++){ + cin >> x; + freq[x]+=1; + } + for(auto m : freq){ + cout << m << " "; + } + cout << endl; + return 0; +} diff --git a/CountingSort2.cpp b/CountingSort2.cpp deleted file mode 100644 index 29fb91c..0000000 --- a/CountingSort2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace std; - -int main() { - int n, x; - cin >> n; - vector v; - vector freq(100); - for(int i = 0; i < n; i ++){ - cin >> x; - freq[x]+=1; - } - for(int i = 0; i < freq.size(); i++){ - for(int j = 0; j < freq[i]; j++){ - cout << i << " "; - } - } - cout << endl; - return 0; -} diff --git a/CountingSort2/CountingSort2.cpp b/CountingSort2/CountingSort2.cpp new file mode 100644 index 0000000..29fb91c --- /dev/null +++ b/CountingSort2/CountingSort2.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() { + int n, x; + cin >> n; + vector v; + vector freq(100); + for(int i = 0; i < n; i ++){ + cin >> x; + freq[x]+=1; + } + for(int i = 0; i < freq.size(); i++){ + for(int j = 0; j < freq[i]; j++){ + cout << i << " "; + } + } + cout << endl; + return 0; +} diff --git a/Diagonal_Difference.cpp b/Diagonal_Difference.cpp deleted file mode 100644 index cb7c2f2..0000000 --- a/Diagonal_Difference.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -using namespace std; - -int main(){ - int n; - cin >> n; - vector v1(n); - vector> v2; - for(int i = 0; i < n; i++){ - for(auto &x : v1){ - cin >> x; - cout << "x: " << x << endl; - } - v2.push_back(v1); - } - int dg1 = 0, dg2 = 0; - for(int i = 0; i < n; i++){ - dg1+=v2[i][i]; - } - for(int i = 0; i < n; i++){ - dg2+=v2[i][n-i-1]; - } - cout << abs(dg2 - dg1) << endl; - - - return 0; - -} - diff --git a/Diagonal_Difference/Diagonal_Difference.cpp b/Diagonal_Difference/Diagonal_Difference.cpp new file mode 100644 index 0000000..cb7c2f2 --- /dev/null +++ b/Diagonal_Difference/Diagonal_Difference.cpp @@ -0,0 +1,30 @@ +#include + +using namespace std; + +int main(){ + int n; + cin >> n; + vector v1(n); + vector> v2; + for(int i = 0; i < n; i++){ + for(auto &x : v1){ + cin >> x; + cout << "x: " << x << endl; + } + v2.push_back(v1); + } + int dg1 = 0, dg2 = 0; + for(int i = 0; i < n; i++){ + dg1+=v2[i][i]; + } + for(int i = 0; i < n; i++){ + dg2+=v2[i][n-i-1]; + } + cout << abs(dg2 - dg1) << endl; + + + return 0; + +} + diff --git a/Dictionary.cpp b/Dictionary.cpp deleted file mode 100644 index e74018a..0000000 --- a/Dictionary.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -using namespace std; - -int solve(char c1, char c2, string letters) { - int c1Pos = letters.find(c1); - letters.erase(remove(letters.begin(), letters.end(), c1), letters.end()); - int c2Pos = letters.find(c2) + 1; - return (c1Pos * 25 + c2Pos); -} - -int main() { - string letters = "abcdefghijklmnopqrstuvwxyz"; - int tt; - cin >> tt; - while (tt--) { - char c1, c2; - cin >> c1 >> c2; - cout << solve(c1, c2, letters) << endl; - } - return 0; -} diff --git a/Dictionary/Dictionary.cpp b/Dictionary/Dictionary.cpp new file mode 100644 index 0000000..e74018a --- /dev/null +++ b/Dictionary/Dictionary.cpp @@ -0,0 +1,22 @@ +#include + +using namespace std; + +int solve(char c1, char c2, string letters) { + int c1Pos = letters.find(c1); + letters.erase(remove(letters.begin(), letters.end(), c1), letters.end()); + int c2Pos = letters.find(c2) + 1; + return (c1Pos * 25 + c2Pos); +} + +int main() { + string letters = "abcdefghijklmnopqrstuvwxyz"; + int tt; + cin >> tt; + while (tt--) { + char c1, c2; + cin >> c1 >> c2; + cout << solve(c1, c2, letters) << endl; + } + return 0; +} diff --git a/DiffucltyRatingOrder.cpp b/DiffucltyRatingOrder.cpp deleted file mode 100644 index 1ed740d..0000000 --- a/DiffucltyRatingOrder.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -using namespace std; -bool isIncreasing(vector v) { - for(int i = 0; i < v.size() - 1; i++) { - if(v[i+1] < v[i]) { - return false; - } - } - return true; -} - - -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; - cin >> n; - vector v(n); - for(int &x : v) cin >> x; - cout << (isIncreasing(v) ? "YES" : "NO") << '\n'; - } -} diff --git a/DiffucltyRatingOrder/DiffucltyRatingOrder.cpp b/DiffucltyRatingOrder/DiffucltyRatingOrder.cpp new file mode 100644 index 0000000..1ed740d --- /dev/null +++ b/DiffucltyRatingOrder/DiffucltyRatingOrder.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; +bool isIncreasing(vector v) { + for(int i = 0; i < v.size() - 1; i++) { + if(v[i+1] < v[i]) { + return false; + } + } + return true; +} + + +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; + cin >> n; + vector v(n); + for(int &x : v) cin >> x; + cout << (isIncreasing(v) ? "YES" : "NO") << '\n'; + } +} diff --git a/DormsRoom.cpp b/DormsRoom.cpp deleted file mode 100644 index 028ec8a..0000000 --- a/DormsRoom.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -using namespace std; - -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; cin >> n; - string s; cin >> s; - int sp; cin >> sp; - map mp; - for(int i = 0; i < sp; i++) { - char inn; - cin >> inn; - mp[inn] = 1; - } - int mx = 0, c = 0; - for(auto ch : s) { - if(mp[ch]) { - mx = max(c, mx); - c = 1; - } - else { - c++; - } - } - cout << mx << endl; - } -} diff --git a/DormsRoom/DormsRoom.cpp b/DormsRoom/DormsRoom.cpp new file mode 100644 index 0000000..028ec8a --- /dev/null +++ b/DormsRoom/DormsRoom.cpp @@ -0,0 +1,30 @@ +#include + +using namespace std; + +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; cin >> n; + string s; cin >> s; + int sp; cin >> sp; + map mp; + for(int i = 0; i < sp; i++) { + char inn; + cin >> inn; + mp[inn] = 1; + } + int mx = 0, c = 0; + for(auto ch : s) { + if(mp[ch]) { + mx = max(c, mx); + c = 1; + } + else { + c++; + } + } + cout << mx << endl; + } +} diff --git a/Equalize_the_array.cpp b/Equalize_the_array.cpp deleted file mode 100644 index 89af0d8..0000000 --- a/Equalize_the_array.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using namespace std; - -int main(){ - int n, x; - cin >> n; - map mp; - vector freq; - for(int i =0; i < n; i++){ - cin >> x; - mp[x]++; - } - for(auto x : mp){ - freq.push_back(x.second); - } - cout << n - *max_element(freq.begin(), freq.end()) << '\n'; - return 0; -} diff --git a/Equalize_the_array/Equalize_the_array.cpp b/Equalize_the_array/Equalize_the_array.cpp new file mode 100644 index 0000000..89af0d8 --- /dev/null +++ b/Equalize_the_array/Equalize_the_array.cpp @@ -0,0 +1,19 @@ +#include + +using namespace std; + +int main(){ + int n, x; + cin >> n; + map mp; + vector freq; + for(int i =0; i < n; i++){ + cin >> x; + mp[x]++; + } + for(auto x : mp){ + freq.push_back(x.second); + } + cout << n - *max_element(freq.begin(), freq.end()) << '\n'; + return 0; +} diff --git a/EvenAndOdd.cpp b/EvenAndOdd.cpp deleted file mode 100644 index 3699c1b..0000000 --- a/EvenAndOdd.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -using namespace std; - -int main() { - int tt; cin >>tt; - while(tt--){ - bool even = true, odd = true; - int n; - cin >> n; - vector v(n); - for(int &x : v) cin >> x; - for(int i : v) { - if(i % 2 != 0) { - even = false; - } - } - for(int i : v) { - if(i % 2 == 0) { - odd = false; - } - } - cout << (!even && !odd ? "Mix" : even ? "Even" : "Odd") << endl; - } -} diff --git a/EvenAndOdd/EvenAndOdd.cpp b/EvenAndOdd/EvenAndOdd.cpp new file mode 100644 index 0000000..3699c1b --- /dev/null +++ b/EvenAndOdd/EvenAndOdd.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main() { + int tt; cin >>tt; + while(tt--){ + bool even = true, odd = true; + int n; + cin >> n; + vector v(n); + for(int &x : v) cin >> x; + for(int i : v) { + if(i % 2 != 0) { + even = false; + } + } + for(int i : v) { + if(i % 2 == 0) { + odd = false; + } + } + cout << (!even && !odd ? "Mix" : even ? "Even" : "Odd") << endl; + } +} diff --git a/FallDown.cpp b/FallDown.cpp deleted file mode 100644 index 718dcb3..0000000 --- a/FallDown.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -using namespace std; -int main() { - int tt; - cin >> tt; - while(tt--) { - int r, c; - cin >> r >> c; - vector grid(r); - for(auto &s : grid) { - cin >> s; - } - for(int i = grid.size() - 2; i >= 0; i--) { - for(int j = 0; j < grid[i].size(); j++) { - int t = i; - if(grid[i][j] == '*'){ - while(t < r - 1 && grid[t+1][j] == '.'){ - grid[t+1][j] = '*'; - grid[t][j] = '.'; - t++; - } - } - } - } - for(auto s : grid) { - cout << s << endl; - } - } - } - - - - - - - diff --git a/FallDown/FallDown.cpp b/FallDown/FallDown.cpp new file mode 100644 index 0000000..718dcb3 --- /dev/null +++ b/FallDown/FallDown.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; +int main() { + int tt; + cin >> tt; + while(tt--) { + int r, c; + cin >> r >> c; + vector grid(r); + for(auto &s : grid) { + cin >> s; + } + for(int i = grid.size() - 2; i >= 0; i--) { + for(int j = 0; j < grid[i].size(); j++) { + int t = i; + if(grid[i][j] == '*'){ + while(t < r - 1 && grid[t+1][j] == '.'){ + grid[t+1][j] = '*'; + grid[t][j] = '.'; + t++; + } + } + } + } + for(auto s : grid) { + cout << s << endl; + } + } + } + + + + + + + diff --git a/Flipping_bits.cpp b/Flipping_bits.cpp deleted file mode 100644 index e06235b..0000000 --- a/Flipping_bits.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - - -using namespace std; - -int main(){ - int n, x=pow(2, 31) - 1; - cin >> n; - cout << n ^ x; - // 0 0 -> 1 -> 0 - // 1 1 -> 0 -> 1 - // 1 1 -> 0 -> 1 - // 1 1 -> 0 -> 0 - - return 0; -} diff --git a/Flipping_bits/Flipping_bits.cpp b/Flipping_bits/Flipping_bits.cpp new file mode 100644 index 0000000..e06235b --- /dev/null +++ b/Flipping_bits/Flipping_bits.cpp @@ -0,0 +1,16 @@ +#include + + +using namespace std; + +int main(){ + int n, x=pow(2, 31) - 1; + cin >> n; + cout << n ^ x; + // 0 0 -> 1 -> 0 + // 1 1 -> 0 -> 1 + // 1 1 -> 0 -> 1 + // 1 1 -> 0 -> 0 + + return 0; +} diff --git a/Football.cpp b/Football.cpp deleted file mode 100644 index 7c78b0d..0000000 --- a/Football.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -using namespace std; -int main() { - string s; - cin >> s; - int mx = 0; - int ans = 0; - for(int i = 0; i < s.size() - 1; i++) { - if(s[i] == s[i+1]){ - ans++; - } else { - mx = max(ans + 1, mx); - ans=0; - } - } - mx = max(ans + 1, mx); - cout << (mx >= 7 ? "YES" : "NO") << endl; -} diff --git a/Football/Football.cpp b/Football/Football.cpp new file mode 100644 index 0000000..7c78b0d --- /dev/null +++ b/Football/Football.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; +int main() { + string s; + cin >> s; + int mx = 0; + int ans = 0; + for(int i = 0; i < s.size() - 1; i++) { + if(s[i] == s[i+1]){ + ans++; + } else { + mx = max(ans + 1, mx); + ans=0; + } + } + mx = max(ans + 1, mx); + cout << (mx >= 7 ? "YES" : "NO") << endl; +} diff --git a/HelpfulMaths.cpp b/HelpfulMaths.cpp deleted file mode 100644 index 580b2fa..0000000 --- a/HelpfulMaths.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -using namespace std; - -int main() { - string s; - cin >> s; - vector v; - for (auto ch : s) { - if(ch != '+') { - v.push_back(ch - 48); - } - } - sort(v.begin(), v.end()); - for(int i = 0; i < v.size(); i++) { - if(i == v.size() - 1) { - cout << v[i]; - } - else { - cout << v[i] << "+"; - } - } - cout << '\n'; -} diff --git a/HelpfulMaths/HelpfulMaths.cpp b/HelpfulMaths/HelpfulMaths.cpp new file mode 100644 index 0000000..580b2fa --- /dev/null +++ b/HelpfulMaths/HelpfulMaths.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() { + string s; + cin >> s; + vector v; + for (auto ch : s) { + if(ch != '+') { + v.push_back(ch - 48); + } + } + sort(v.begin(), v.end()); + for(int i = 0; i < v.size(); i++) { + if(i == v.size() - 1) { + cout << v[i]; + } + else { + cout << v[i] << "+"; + } + } + cout << '\n'; +} diff --git a/InfiniteReplacement.cpp b/InfiniteReplacement.cpp deleted file mode 100644 index 850e0ec..0000000 --- a/InfiniteReplacement.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -using namespace std; - -int main() { - int tt; - cin >> tt; - string s, t; - while (tt--) { - cin >> s; - cin >> t; - if(t.find('a') != std::string::npos && t.length() > 1) { - cout << "-1" << endl; - } - else if(t.find('a') != std::string::npos && t.length() == 1) { - cout << "1" << endl; - } - else { - long long ans = pow(2, s.length()); - cout << ans << endl; - } - } - - return 0; -} diff --git a/InfiniteReplacement/InfiniteReplacement.cpp b/InfiniteReplacement/InfiniteReplacement.cpp new file mode 100644 index 0000000..850e0ec --- /dev/null +++ b/InfiniteReplacement/InfiniteReplacement.cpp @@ -0,0 +1,26 @@ +#include +#include + +using namespace std; + +int main() { + int tt; + cin >> tt; + string s, t; + while (tt--) { + cin >> s; + cin >> t; + if(t.find('a') != std::string::npos && t.length() > 1) { + cout << "-1" << endl; + } + else if(t.find('a') != std::string::npos && t.length() == 1) { + cout << "1" << endl; + } + else { + long long ans = pow(2, s.length()); + cout << ans << endl; + } + } + + return 0; +} diff --git a/InfinityStaircase.cpp b/InfinityStaircase.cpp deleted file mode 100644 index aeb982a..0000000 --- a/InfinityStaircase.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -using namespace std; - -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; - cin >> n; - n-=1; - if(n % 5 == 0) { - cout << (n / 5) * 2 << endl; - } - else{ - if(n % 5 == 1 || n % 5 == 2 || n % 5 == 3) { - cout << ((n / 5) * 2) + 1 << endl; - } - else if(n % 5 == 4) { - cout << ((n / 5) * 2) + 2 << endl; - } - } - } -} diff --git a/InfinityStaircase/InfinityStaircase.cpp b/InfinityStaircase/InfinityStaircase.cpp new file mode 100644 index 0000000..aeb982a --- /dev/null +++ b/InfinityStaircase/InfinityStaircase.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; + cin >> n; + n-=1; + if(n % 5 == 0) { + cout << (n / 5) * 2 << endl; + } + else{ + if(n % 5 == 1 || n % 5 == 2 || n % 5 == 3) { + cout << ((n / 5) * 2) + 1 << endl; + } + else if(n % 5 == 4) { + cout << ((n / 5) * 2) + 2 << endl; + } + } + } +} diff --git a/LisaWorkbook.cpp b/LisaWorkbook.cpp deleted file mode 100644 index 6d8532c..0000000 --- a/LisaWorkbook.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n, k; - cin >> n >> k; - int pg = 1, res = 0; - for (int i = 0; i < n; i++) { - int np; - cin >> np; - for (int j = 1; j <= np ; j++) { - if (j == pg) { - res++; - } - if (j % k == 0 && j < np) { - pg++; - } - } - pg++; - } - cout << res << endl; - return 0; -} diff --git a/LisaWorkbook/LisaWorkbook.cpp b/LisaWorkbook/LisaWorkbook.cpp new file mode 100644 index 0000000..6d8532c --- /dev/null +++ b/LisaWorkbook/LisaWorkbook.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main() +{ + int n, k; + cin >> n >> k; + int pg = 1, res = 0; + for (int i = 0; i < n; i++) { + int np; + cin >> np; + for (int j = 1; j <= np ; j++) { + if (j == pg) { + res++; + } + if (j % k == 0 && j < np) { + pg++; + } + } + pg++; + } + cout << res << endl; + return 0; +} diff --git a/LonelyInteger.cpp b/LonelyInteger.cpp deleted file mode 100644 index a5ce4a4..0000000 --- a/LonelyInteger.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using namespace std; -int main(){ - int n, x = 0, k; - cin >> n; - for(int i = 0; i < n; i++){ - cin >> k; - x ^= k; - } - cout << x; - return 0; -} diff --git a/LonelyInteger/LonelyInteger.cpp b/LonelyInteger/LonelyInteger.cpp new file mode 100644 index 0000000..a5ce4a4 --- /dev/null +++ b/LonelyInteger/LonelyInteger.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; +int main(){ + int n, x = 0, k; + cin >> n; + for(int i = 0; i < n; i++){ + cin >> k; + x ^= k; + } + cout << x; + return 0; +} diff --git a/Luck_balance.cpp b/Luck_balance.cpp deleted file mode 100644 index 403b53f..0000000 --- a/Luck_balance.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -using namespace std; -bool comparePair(pair p1, pair p2){ - if(p1.second >= p2.second && p1.first > p2.first){ - return true; - } - else { - return false; - } -} - -int main() { - int n, k, sum = 0, cn=0; - cin >> n >> k; - vector> vp(n); - for(auto &x : vp){ - cin >> x.first >> x.second; - } - sort(vp.begin(), vp.end(), comparePair); - cout << "-----------------------------------"; - cout << endl; - for(auto x : vp){ - cout << x.first << " " << x.second << endl; - } - for(int i = 0; i < n; i++){ - if(vp[i].second == 1){ - cn++; - } - if(cn != k - 1){ - cout << "vp[" << i << "]" << vp[i].first << endl; - sum+=vp[i].first; - } - } - sum -= vp[cn].first; - cout << sum << endl; - return 0; -} diff --git a/Luck_balance/Luck_balance.cpp b/Luck_balance/Luck_balance.cpp new file mode 100644 index 0000000..403b53f --- /dev/null +++ b/Luck_balance/Luck_balance.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +bool comparePair(pair p1, pair p2){ + if(p1.second >= p2.second && p1.first > p2.first){ + return true; + } + else { + return false; + } +} + +int main() { + int n, k, sum = 0, cn=0; + cin >> n >> k; + vector> vp(n); + for(auto &x : vp){ + cin >> x.first >> x.second; + } + sort(vp.begin(), vp.end(), comparePair); + cout << "-----------------------------------"; + cout << endl; + for(auto x : vp){ + cout << x.first << " " << x.second << endl; + } + for(int i = 0; i < n; i++){ + if(vp[i].second == 1){ + cn++; + } + if(cn != k - 1){ + cout << "vp[" << i << "]" << vp[i].first << endl; + sum+=vp[i].first; + } + } + sum -= vp[cn].first; + cout << sum << endl; + return 0; +} diff --git a/MakeItIncreasing.cpp b/MakeItIncreasing.cpp deleted file mode 100644 index 987ef04..0000000 --- a/MakeItIncreasing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -using namespace std; -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; - int ans = 0; - cin >> n; - vector v(n); - for(auto &x : v) cin >> x; - for(int i = n - 1; i > 0; i--) { - while(v[i] <= v[i-1] && v[i - 1] > 0) { - v[i-1] = v[i-1] / 2; - ans++; - } - if(v[i] == v[i-1]) { - ans = -1; - break; - } - } - cout << ans << endl; - } -} diff --git a/MakeItIncreasing/MakeItIncreasing.cpp b/MakeItIncreasing/MakeItIncreasing.cpp new file mode 100644 index 0000000..987ef04 --- /dev/null +++ b/MakeItIncreasing/MakeItIncreasing.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; + int ans = 0; + cin >> n; + vector v(n); + for(auto &x : v) cin >> x; + for(int i = n - 1; i > 0; i--) { + while(v[i] <= v[i-1] && v[i - 1] > 0) { + v[i-1] = v[i-1] / 2; + ans++; + } + if(v[i] == v[i-1]) { + ans = -1; + break; + } + } + cout << ans << endl; + } +} diff --git a/MarcCakwalk.cpp b/MarcCakwalk.cpp deleted file mode 100644 index 91884fd..0000000 --- a/MarcCakwalk.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -using namespace std; -int main(){ - int n; - long sum; - cin >> n; - vector v(n); - for(auto &x : v){ - cin >> x; - } - sort(v.begin(), v.end()); - for(int i = 0; i < n; i++){ - cout << "v[" << i << "] = " << v[i] << " * " << "2^" << n - i - 1 << endl; - sum += v[i] * pow(2, n - i - 1); - } - cout << sum << endl; - return 0; -} diff --git a/MarcCakwalk/MarcCakwalk.cpp b/MarcCakwalk/MarcCakwalk.cpp new file mode 100644 index 0000000..91884fd --- /dev/null +++ b/MarcCakwalk/MarcCakwalk.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; +int main(){ + int n; + long sum; + cin >> n; + vector v(n); + for(auto &x : v){ + cin >> x; + } + sort(v.begin(), v.end()); + for(int i = 0; i < n; i++){ + cout << "v[" << i << "] = " << v[i] << " * " << "2^" << n - i - 1 << endl; + sum += v[i] * pow(2, n - i - 1); + } + cout << sum << endl; + return 0; +} diff --git a/MaximizingXOR.cpp b/MaximizingXOR.cpp deleted file mode 100644 index 71fc6d8..0000000 --- a/MaximizingXOR.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using namespace std; - -int main() { - int l, r; - cin >> l >> r; - priority_queuepq; - for(int i = l; i <= r;i++) { - for(int j = i; j <= r;j++) { - pq.push(i ^ j); - } - } - cout << pq.top() << '\n'; - return 0; -} diff --git a/MaximizingXOR/MaximizingXOR.cpp b/MaximizingXOR/MaximizingXOR.cpp new file mode 100644 index 0000000..71fc6d8 --- /dev/null +++ b/MaximizingXOR/MaximizingXOR.cpp @@ -0,0 +1,17 @@ +#include +#include + +using namespace std; + +int main() { + int l, r; + cin >> l >> r; + priority_queuepq; + for(int i = l; i <= r;i++) { + for(int j = i; j <= r;j++) { + pq.push(i ^ j); + } + } + cout << pq.top() << '\n'; + return 0; +} diff --git a/MinDiffInArray.cpp b/MinDiffInArray.cpp deleted file mode 100644 index 5440d03..0000000 --- a/MinDiffInArray.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using namespace std; -int main(){ - int n; - cin >> n; - vector v(n); - vector res; - for(auto &x : v){ - cin >> x; - } - sort(v.begin(), v.end()); - for(int i = 0; i < n - 1; i++){ - // 1 2 3 4 5 6 7 - res.push_back(abs(v[i] - v[i+1])); - } - cout << *min_element(res.begin(), res.end()) << endl; - return 0; -} - diff --git a/MinDiffInArray/MinDiffInArray.cpp b/MinDiffInArray/MinDiffInArray.cpp new file mode 100644 index 0000000..5440d03 --- /dev/null +++ b/MinDiffInArray/MinDiffInArray.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +int main(){ + int n; + cin >> n; + vector v(n); + vector res; + for(auto &x : v){ + cin >> x; + } + sort(v.begin(), v.end()); + for(int i = 0; i < n - 1; i++){ + // 1 2 3 4 5 6 7 + res.push_back(abs(v[i] - v[i+1])); + } + cout << *min_element(res.begin(), res.end()) << endl; + return 0; +} + diff --git a/NumberTransformation.cpp b/NumberTransformation.cpp deleted file mode 100644 index a16cc9d..0000000 --- a/NumberTransformation.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -using namespace std; - -int main() { - int tt; - cin >> tt; - while(tt--) { - vector v(2); - for(int &x: v){ - cin >> x; - } - int i = 0; - while(true) { - int z = v[1] / v[0]; - i++; - if(v[1] < v[0] || v[1] % v[0] != 0) { - cout << 0 << " " << 0 << '\n'; - break; - } - bool l = int(pow(z, 1.0/i)) == pow(z, 1.0/i); - if(l) { - cout << i << " " << pow(z, 1.0 / i) << '\n'; - break; - } - } - } - - - return 0; -} diff --git a/NumberTransformation/NumberTransformation.cpp b/NumberTransformation/NumberTransformation.cpp new file mode 100644 index 0000000..a16cc9d --- /dev/null +++ b/NumberTransformation/NumberTransformation.cpp @@ -0,0 +1,31 @@ +#include + +using namespace std; + +int main() { + int tt; + cin >> tt; + while(tt--) { + vector v(2); + for(int &x: v){ + cin >> x; + } + int i = 0; + while(true) { + int z = v[1] / v[0]; + i++; + if(v[1] < v[0] || v[1] % v[0] != 0) { + cout << 0 << " " << 0 << '\n'; + break; + } + bool l = int(pow(z, 1.0/i)) == pow(z, 1.0/i); + if(l) { + cout << i << " " << pow(z, 1.0 / i) << '\n'; + break; + } + } + } + + + return 0; +} diff --git a/Odd-EvenIncrements.cpp b/Odd-EvenIncrements.cpp deleted file mode 100644 index dad00f5..0000000 --- a/Odd-EvenIncrements.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -using namespace std; -bool isEvenOrOdd(vector v) { - bool even = false; - bool odd = false; - for(int x : v) { - if(x % 2 != 0) { - even = false; - break; - } - else{ - even = true; - } - } - for(int x : v) { - if(x % 2 == 0) { - odd = false; - break; - } - else{ - odd = true; - } - } - return odd || even; -} - -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; - cin >> n; - vector v(n); - vector vEven; - vector vOdd; - for(int &x : v) { - cin >> x; - } - bool ok = isEvenOrOdd(v); - for(int x : v) { - vEven.push_back(x); - vOdd.push_back(x); - } - for(int i = 0; i < v.size(); i++) { - if(i % 2 == 0){ - vEven[i]++; - } - } - bool evenOp = isEvenOrOdd(vEven); - for(int i = 0; i < v.size(); i++) { - if(i % 2 != 0){ - vOdd[i]++; - } - } - bool oddOp = isEvenOrOdd(vOdd); - cout << (ok ? "YES" : (evenOp || oddOp ? "YES" : "NO")) << endl; - - } -} diff --git a/Odd-EvenIncrements/Odd-EvenIncrements.cpp b/Odd-EvenIncrements/Odd-EvenIncrements.cpp new file mode 100644 index 0000000..dad00f5 --- /dev/null +++ b/Odd-EvenIncrements/Odd-EvenIncrements.cpp @@ -0,0 +1,59 @@ +#include +using namespace std; +bool isEvenOrOdd(vector v) { + bool even = false; + bool odd = false; + for(int x : v) { + if(x % 2 != 0) { + even = false; + break; + } + else{ + even = true; + } + } + for(int x : v) { + if(x % 2 == 0) { + odd = false; + break; + } + else{ + odd = true; + } + } + return odd || even; +} + +int main() { + int tt; + cin >> tt; + while(tt--) { + int n; + cin >> n; + vector v(n); + vector vEven; + vector vOdd; + for(int &x : v) { + cin >> x; + } + bool ok = isEvenOrOdd(v); + for(int x : v) { + vEven.push_back(x); + vOdd.push_back(x); + } + for(int i = 0; i < v.size(); i++) { + if(i % 2 == 0){ + vEven[i]++; + } + } + bool evenOp = isEvenOrOdd(vEven); + for(int i = 0; i < v.size(); i++) { + if(i % 2 != 0){ + vOdd[i]++; + } + } + bool oddOp = isEvenOrOdd(vOdd); + cout << (ok ? "YES" : (evenOp || oddOp ? "YES" : "NO")) << endl; + + } +} diff --git a/PerfectlyBalancedString.cpp b/PerfectlyBalancedString.cpp deleted file mode 100644 index a83c3f4..0000000 --- a/PerfectlyBalancedString.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -using namespace std; -int main() { - int tt; - cin >> tt; - string s; - while(tt--){ - cin >> s; - bool ok = true; - do{ - cout << s << endl; - map mp; - for(auto ch : s) { - mp[ch]++; - } - int mx = 1; - int mn = 1; - for(auto x : mp){ - mx = max(mx, x.second); - mn = min(mn, x.second); - // cout << x.first << " " << x.second << endl; - } - if(mx - mn > 1) { - ok = false; - break; - } - } while(next_permutation(s.begin(), s.end())); - cout << (ok ? "YES" : "NO"); - cout << endl; - } -} - diff --git a/PerfectlyBalancedString/PerfectlyBalancedString.cpp b/PerfectlyBalancedString/PerfectlyBalancedString.cpp new file mode 100644 index 0000000..a83c3f4 --- /dev/null +++ b/PerfectlyBalancedString/PerfectlyBalancedString.cpp @@ -0,0 +1,33 @@ +#include +#include +using namespace std; +int main() { + int tt; + cin >> tt; + string s; + while(tt--){ + cin >> s; + bool ok = true; + do{ + cout << s << endl; + map mp; + for(auto ch : s) { + mp[ch]++; + } + int mx = 1; + int mn = 1; + for(auto x : mp){ + mx = max(mx, x.second); + mn = min(mn, x.second); + // cout << x.first << " " << x.second << endl; + } + if(mx - mn > 1) { + ok = false; + break; + } + } while(next_permutation(s.begin(), s.end())); + cout << (ok ? "YES" : "NO"); + cout << endl; + } +} + diff --git a/PrimeOrNot.cpp b/PrimeOrNot.cpp deleted file mode 100644 index 1995e85..0000000 --- a/PrimeOrNot.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; - -int main() { - long long p; - bool flag = false; - cin >> p; - for(long long i = 2; i * i <= p; i++){ - if(p % i == 0) { - flag = true; - break; - } - } - if(p == 1) flag = true; - cout << (flag ? "Not Prime" : "Prime") << endl; -} diff --git a/PrimeOrNot/PrimeOrNot.cpp b/PrimeOrNot/PrimeOrNot.cpp new file mode 100644 index 0000000..1995e85 --- /dev/null +++ b/PrimeOrNot/PrimeOrNot.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; + +int main() { + long long p; + bool flag = false; + cin >> p; + for(long long i = 2; i * i <= p; i++){ + if(p % i == 0) { + flag = true; + break; + } + } + if(p == 1) flag = true; + cout << (flag ? "Not Prime" : "Prime") << endl; +} diff --git a/SequenceEquation.cpp b/SequenceEquation.cpp deleted file mode 100644 index 1714728..0000000 --- a/SequenceEquation.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -using namespace std; - -int main(){ - int n, count = 1; - cin >> n; - vector v(n); - map mp; - for(auto &x : v){ - cin >> x; - mp[x] = count; - count++; - } - for(auto x : mp){ - auto it = find(v.begin(), v.end(), x.second); - cout << "value: " << x.first << " Index: " << x.second << endl; - cout << it - v.begin() + 1<< endl; - } - - - - - return 0; -} diff --git a/SequenceEquation/SequenceEquation.cpp b/SequenceEquation/SequenceEquation.cpp new file mode 100644 index 0000000..1714728 --- /dev/null +++ b/SequenceEquation/SequenceEquation.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main(){ + int n, count = 1; + cin >> n; + vector v(n); + map mp; + for(auto &x : v){ + cin >> x; + mp[x] = count; + count++; + } + for(auto x : mp){ + auto it = find(v.begin(), v.end(), x.second); + cout << "value: " << x.first << " Index: " << x.second << endl; + cout << it - v.begin() + 1<< endl; + } + + + + + return 0; +} diff --git a/StringTask.cpp b/StringTask.cpp deleted file mode 100644 index 74d4635..0000000 --- a/StringTask.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -using namespace std; - -int main() { - ios::sync_with_stdio(false); - cin.tie(0); - string s; - cin >> s; - string vowels = "aeiouy"; - set st(vowels.begin(), vowels.end()); - string ans = ""; - for (char ch : s) { - if (!st.count(tolower(ch))) { - ans += "." + string(1, tolower(ch)); - } - } - cout << ans << '\n'; - return 0; -} diff --git a/StringTask/StringTask.cpp b/StringTask/StringTask.cpp new file mode 100644 index 0000000..74d4635 --- /dev/null +++ b/StringTask/StringTask.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(false); + cin.tie(0); + string s; + cin >> s; + string vowels = "aeiouy"; + set st(vowels.begin(), vowels.end()); + string ans = ""; + for (char ch : s) { + if (!st.count(tolower(ch))) { + ans += "." + string(1, tolower(ch)); + } + } + cout << ans << '\n'; + return 0; +} diff --git a/SumsOfSubSequence.cpp b/SumsOfSubSequence.cpp deleted file mode 100644 index 9460ce3..0000000 --- a/SumsOfSubSequence.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -using namespace std; - -int main() { - int tt; cin >> tt; - while(tt--) { - vector v(7); - for(int &x : v) { - cin >> x; - } - cout << v[0] << " " << v[1] << " " << v[6] - v[1] - v[0] << endl; - } -} diff --git a/SumsOfSubSequence/SumsOfSubSequence.cpp b/SumsOfSubSequence/SumsOfSubSequence.cpp new file mode 100644 index 0000000..9460ce3 --- /dev/null +++ b/SumsOfSubSequence/SumsOfSubSequence.cpp @@ -0,0 +1,14 @@ +#include + +using namespace std; + +int main() { + int tt; cin >> tt; + while(tt--) { + vector v(7); + for(int &x : v) { + cin >> x; + } + cout << v[0] << " " << v[1] << " " << v[6] - v[1] - v[0] << endl; + } +} diff --git a/TakeDiscountOrNot.cpp b/TakeDiscountOrNot.cpp deleted file mode 100644 index 3b4510b..0000000 --- a/TakeDiscountOrNot.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -using namespace std; -int main() { - int tt; - cin >> tt; - while(tt--) { - int n, x, y; - int s1 = x, s2 = 0; - cin >> n >> x >> y; - for(int i = 0; i < n; i++) { - int h; - cin >> h; - s2+=h; - s1+=max(0, h - y); - } - cout << (s1 < s2 ? "COUPON" : "NO COUPON") << '\n'; - } -} diff --git a/TakeDiscountOrNot/TakeDiscountOrNot.cpp b/TakeDiscountOrNot/TakeDiscountOrNot.cpp new file mode 100644 index 0000000..3b4510b --- /dev/null +++ b/TakeDiscountOrNot/TakeDiscountOrNot.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; +int main() { + int tt; + cin >> tt; + while(tt--) { + int n, x, y; + int s1 = x, s2 = 0; + cin >> n >> x >> y; + for(int i = 0; i < n; i++) { + int h; + cin >> h; + s2+=h; + s1+=max(0, h - y); + } + cout << (s1 < s2 ? "COUPON" : "NO COUPON") << '\n'; + } +} diff --git a/ThePowerSum.cpp b/ThePowerSum.cpp deleted file mode 100644 index 7f7e032..0000000 --- a/ThePowerSum.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -using namespace std; - -int power(int base, int p){ - if(p == 0) { - return 1; - } - return base * (power(base, p - 1)); -} - -vector ans; - -int powerSum(int x, int n, int lastDigit) { - if (x == 0) { - for(int x : ans) { - cout << x << "^" << n << " + "; - } - cout << endl; - return 1; - } - int sum = 0; - for(int i = lastDigit; x - power(i, n) >= 0; i++) { - ans.push_back(i); - sum += powerSum(x - power(i, n), n, i + 1); - ans.pop_back(); - } - return sum; -} - -int main() { - int x, n, count = 0; - cin >> x >> n; - cout << powerSum(x, n, 1) << endl; - return 0; -} diff --git a/ThePowerSum/ThePowerSum.cpp b/ThePowerSum/ThePowerSum.cpp new file mode 100644 index 0000000..7f7e032 --- /dev/null +++ b/ThePowerSum/ThePowerSum.cpp @@ -0,0 +1,36 @@ +#include + +using namespace std; + +int power(int base, int p){ + if(p == 0) { + return 1; + } + return base * (power(base, p - 1)); +} + +vector ans; + +int powerSum(int x, int n, int lastDigit) { + if (x == 0) { + for(int x : ans) { + cout << x << "^" << n << " + "; + } + cout << endl; + return 1; + } + int sum = 0; + for(int i = lastDigit; x - power(i, n) >= 0; i++) { + ans.push_back(i); + sum += powerSum(x - power(i, n), n, i