3

Having issues with a particular problem 1762A Divide and Conquer

 1 year ago
source link: https://codeforces.com/blog/entry/111707
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

//codeforces problem link: https://codeforces.com/contest/1762/problem/A Divide and Conquer.

my alogorithm: We are asked to find least amount steps that is required to make an array good(sum is even). I took the lowset number in the array and tried to divide it by 2(according to question) and then do the sum again until we find the sum as an even number. Thus we will get the least required steps.

Here's my my submission in C I have provided adequate notes to help understand my code and variables. ] I would be grateful if someone help me understand this problem. Thank you. edit1: I used printf functions to help troubleshoot the problem. without the printf functions it passes test case 1 and two test cases of test case 2.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK