Laddu Problem Code: LADDU

https://www.codechef.com/viewsolution/37999218

Hello I’m looking for help to Solve LADDU problem in DSA Learning Series

Please tell me why my solution is failed for 3 tasks or tell me what corner case I’m missing to solve

Thanks in advance for help

I can’t see anywhere where you’re accounting for this.

2 Likes

Thanks a lot @ssjgz
Adding this line solved my problem
contest_win_rank>20?laddus+=300:laddus+=300+(20-contest_win_rank);

1 Like

https://www.codechef.com/viewsolution/41505958

I have no idea why it is a :x:
Plz help

First, fix these warnings:

sayucodes-LADDU.cpp: In function ‘int func(char*, int, int)’:
sayucodes-LADDU.cpp:10:13: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if (c1 == "INDIAN")
             ^~~~~~~~
sayucodes-LADDU.cpp:12:18: warning: comparison with string literal results in unspecified behavior [-Waddress]
   else if (c1 == "NON_INDIAN")
                  ^~~~~~~~~~~~
sayucodes-LADDU.cpp: In function ‘int main()’:
sayucodes-LADDU.cpp:16:7: warning: unused variable ‘lad’ [-Wunused-variable]
   int lad = 0, t;
       ^~~
sayucodes-LADDU.cpp: In function ‘int func(char*, int, int)’:
sayucodes-LADDU.cpp:14:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

Edit:

Also, please don’t spam your question multiple times :slight_smile:

2 Likes

I have no idea what the last warning means
but https://onlinegdb.com/1PjXJGeH0 - I am getting -78 as an O/P this time for “INDIAN :sleepy: :sleepy: