437A - The Child and Homework - CodeForces Solution


implementation *1300

Please click on ads to support us..

C++ Code:

#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
    string a,b,c,d;
    cin>>a>>b>>c>>d;
    vector<pair<int,char>> v;
    v.push_back(make_pair(a.length()-2,'A'));
    v.push_back(make_pair(b.length()-2,'B'));
    v.push_back(make_pair(c.length()-2,'C'));
    v.push_back(make_pair(d.length()-2,'D'));
    sort(v.begin(),v.end());
    vector<char> ans;
    //for(int i=0;i<3;i++){
      //  if(ans.size()<=1)
   //{ 
    if((2*v[0].first)<=v[1].first){
        ans.push_back(v[0].second);
    }
    if( (2*v[2].first)<=v[3].first){
     ans.push_back(v[3].second);
    }
    if(ans.size()==1){
        cout<<ans[0];
    }
    else{
        cout<<"C";
    }
    return 0;

    //}
    }


Comments

Submit
0 Comments
More Questions

1728C - Digital Logarithm
1728D - Letter Picking
792B - Counting-out Rhyme
1195A - Drinks Choosing
5D - Follow Traffic Rules
1272A - Three Friends
1632D - New Year Concert
1400D - Zigzags
716C - Plus and Square Root
412A - Poster
844B - Rectangles
1591A - Life of a Flower
1398C - Good Subarrays
629A - Far Relative’s Birthday Cake
1166A - Silent Classroom
1000B - Light It Up
218B - Airport
1463B - Find The Array
1538C - Number of Pairs
621B - Wet Shark and Bishops
476B - Dreamoon and WiFi
152C - Pocket Book
1681D - Required Length
1725D - Deducing Sortability
1501A - Alexey and Train
721B - Passwords
1263D - Secret Passwords
1371B - Magical Calendar
1726E - Almost Perfect
1360C - Similar Pairs