Skip to content

Instantly share code, notes, and snippets.

Created May 6, 2016 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4ff850122ebaff0d1cbdcdb48bfdce37 to your computer and use it in GitHub Desktop.
Save anonymous/4ff850122ebaff0d1cbdcdb48bfdce37 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
void czynniki(int n);
int main()
{
int C, n;
cin>>C;
string x, s;
for(int q = 0; q < C; q++)
{
cin>>x;
if(x.length() < 3)
{
istringstream iss(x);
iss >> n;
for(int i=n+1;; i++)
{
if(i % 2 == 0 && i % 4 != 0)
{
cout<<s<<i<<endl;
break;
}
}
}
else
{
s = x;
x.erase(0, x.length() - 2);
s.erase(s.length() - 2);
istringstream iss(x);
iss >> n;
for(int i=n+1;; i++)
{
if(i % 2 == 0 && i % 4 != 0)
{
cout<<s<<i<<endl;
break;
}
}
}
x.erase();
s.erase();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment