Pagini recente » Cod sursa (job #887828) | Cod sursa (job #2384113) | Cod sursa (job #2154712) | Cod sursa (job #644494) | Cod sursa (job #3255720)
#include<bits/stdc++.h>
using namespace std;
ifstream f("codificare.in");
ofstream g("codificare.out");
int codpi(int n)
{
int nou = 0 , p = 1;
while(n)
{
if(n % 2 == 0)
{
nou = nou + (n % 10 + 1) * p;
}
else
{
nou = nou + (n % 10 - 1) * p;
}
n = n / 10;
p = p * 10;
}
return nou;
}
int main()
{
int c;
f>>c;
if(c == 1)
{
int n , x , min , max;
min=max=-1;
f>>n;
for(int i=1;i<=n;i++)
{
f>>x;
int cod = codpi(x);
if(cod>x)
{
if(min == -1 && max == -1)
{
min = max = x;
}
if(x>max) max=x;
if(x<min) min=x;
}
}
g<<min<<" "<<max;
}
if(c == 2)
{
}
}