Codeforces 1291A. Even But Not Even Solution

///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd Batch
///Islamic University,Bangladesh
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    long long n,i,c1=0,t;
    string s;
    cin>>t;
    while(t--)
    {
        c1=0;
        vector<int> v;
        cin>>n>>s;
        for(i=0; i<n; i++)
        {
            if(s[i]%2==1)
            {
                c1++;
                v.push_back(i);
            }
        }
            if(c1<2)
                cout<<"-1"<<endl;
            else
            {
                cout<<s[v[0]]<<s[v[1]]<<endl;
            }
        v.erase(v.begin(),v.end());
    }
}

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.