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());
}
}
///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