About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

সোমবার, ১৩ এপ্রিল, ২০১৫

Light Oj:1249 - Chocolate Thief. solution

#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int,string>i,pair<int,string>j)
{
    return i.first<j.first;
}

int main()
{

    vector<pair<int,string> >pi;
    int ary[102];
    int test;
    cin>>test;
    for(int cas=1; cas<=test; cas++)
    {
        int n;
        cin>>n;
        int t=n;
        int k=0;
        pi.clear();
        while(t--)
        {
            string ss;
            int a,b,c;
            cin>>ss>>a>>b>>c;
            pi.push_back(make_pair((a*b*c),ss));
        }

        printf("Case %d: ",cas);
        sort(pi.begin(),pi.end(),cmp);
        // for(int i=0;i<pi.size();i++) cout<<pi[i].first<<" "<<pi[i].second<<endl;



        if(pi[0].first==pi[n-1].first) puts("no thief");
       else  printf("%s took chocolate from %s\n",(pi[n-1].second).c_str(),(pi[0].second).c_str());



    }

    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন