just read the input section.
you are not taking input for length of the activities .According to ur code, it will get executed for single activity.
Your code is giving wrong answer for the given test-case in problem statement:
1
INDIAN
CONTEST_WON 1
TOP_CONTRIBUTOR
BUG_FOUND 100
CONTEST_HOSTED
Output should be:
3
The bugs are the following:
- Read the problem statement carefully, it says that if the person has won the contest, he is sure to get
300
points and look at your code logic in theCONTEST_WON
section. - Ask yourself what is the spelling of
CONTRIBUTER
is, I think you should really check your code by yourself first then post here, otherwise, you would embarrass yourself because of this silly bugs.
NOTE:
-
Write code which is easy to understand, at least when you post on forums, properly indent your code, it really helps people who are looking at your code, because if you don’t do this, it just a waste of time for us, after wasting the time, we find that there is a silly bug in your program which can be easily found if the code was written properly.
-
Don’t use
using namespace std
i.e.namespace std
for the whole file rather limit the scope ofnamespace std
as much as possible.
Refer: Why I don't "using namespace std" - YouTube. -
Write understandable variable names such that its purpose becomes very clear when someone looks at your code.
Solution Code In C, C++ and Python
Competitive-Programming/Code-Chef/Laddu at master · strikersps/Competitive-Programming · GitHub.
I am extremely sorry I will definitely work on all this things.
why there is Need to put Second Loop?Can anyOne please explain
Loop on ------->number of activities