LADDU, can anyone explain? Question link = https://www.codechef.com/LRNDSA01/problems/LADDU

Question link = https://www.codechef.com/LRNDSA01/problems/LADDU

#define ll long long

#include <bits/stdc++.h>
using namespace std;

int main() {
ll t; cin>>t; while(t–){

    ll n,r,s,x=0;
    string a,b,c,d,e;
    cin>>n>>a>>b>>r>>c>>d>>s>>e;
    
    if(b=="CONTEST_WON")
        x=x+300;
    if(r<=20)
        x=x+20-r;
    if(c=="TOP_CONTRIBUTOR")
        x=x+300;
    if(d=="BUG_FOUND")
        x=x+s;
    if(e=="CONTEST_HOSTED")
        x=x+50;
            
    if(a=="INDIAN")
        cout<<x/200<<endl;
    else
        cout<<x/400<<endl;
    
}

}

What is the problem with this code ? May be I am missing the logic.

The number of activities can be greater than 4 as well .
You need to iterate over the number of activities and then check for each input as you have done in if statements.

1 Like

Thanks