#include <stdio.h>
#include <conio.h>
int E(int b)
{
int a,sum=0;
for (a=1;a<(b-1);a++)
if(b%a==0)
sum+=a;
return sum;
}
//----
float nesbat (float x)
{
float a=E(x)/x;
return a;
}
//---------------
int main()
{
float max=0,max2=10,x;
int k=0,maxi;
scanf("%f",&x);
start:
for(float i=0;i<x;i+=10)
{
if(nesbat(i)>max && nesbat(i)<max2) {max=nesbat(i); maxi=i;}
}
printf("%d\n",maxi);
getch();
return 0;
}
#include <stdio.h>
#include <conio.h>
int main()
{
int n,nafar[1000],nafarj,min=1000000,minj=0,tedad1=0,max=0,maxj=10000000,tedad2=0,nafar2[100000];
nafar[0]=-1;
nafar2[0]=-1;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&nafar[i]);
nafar2[i]=nafar[i];
}
//-----------------------------
start:
for(int j=1;j<=n;j++)
{
if(nafar[j]<min && nafar[j]>=minj ) {min=nafar[j]; nafarj=j;}
}
tedad1++;
printf("%d",nafarj);
nafar[nafarj]=min-1;
minj=min;
min=1000001;
if(tedad1<n){
goto start;}
printf("\n");
//-----------------------------
start2:
for(int j=1;j<=n;j++)
{
if(nafar2[j]>max && nafar2[j]<=maxj ) {max=nafar2[j]; nafarj=j;}
}
tedad2++;
printf("%d",nafarj);
nafar2[nafarj]=max+1;
maxj=max;
max=0;
if(tedad2<n){
goto start2;}
getch();
return 0;
}