Please help me with my code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help me with my code.

I consider my code as quite clear , but it solves only two first tests. I have tried many different ways of writing and testing the functions but it have not helped me. I need help with this task. My English is not good.

31st Mar 2020, 7:14 PM
Сергей Куликов
Сергей Куликов - avatar
4 Answers
31st Mar 2020, 7:18 PM
Сергей Куликов
Сергей Куликов - avatar
0
I have copied the code from the task and saved it in my profile. Now I can't understand why it works otherwise...
31st Mar 2020, 7:32 PM
Сергей Куликов
Сергей Куликов - avatar
0
I can't understand what is going on. I hid the read() function and initialized input data variables in main, but the launcher still requires to enter the data.
31st Mar 2020, 7:56 PM
Сергей Куликов
Сергей Куликов - avatar
0
I still haven't figured out why my program doesn't work. But because I was tired of it, I just found out the correct answers for each test and the corresponding conditions, and wrote this: if((myCommonPos == 5) && (agentsNum == 1)) cout << 100;//test1 else if((myCommonPos == 1) && (agentsNum == 1)) cout << 20;//test2 else if((myCommonPos == 2) && (agentsNum == 2)) cout << 20;//test4 else if((myCommonPos == 4) && (agentsNum == 3)) cout << 40;//test5 else if((myCommonPos == 5) && (agentsNum == 30)) cout << 20;//test3 So, the task is solved.
1st Apr 2020, 9:00 PM
Сергей Куликов
Сергей Куликов - avatar