#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<cstring>
#include<string>
using namespace std;
typedef long long int lld;
int main()
{
int a[4]={2,3,5,7};
set<lld> s;
set <lld> :: iterator it;
s.insert(1);
it=s.begin();
while (s.size()<5842)
{
for (int i=0;i<4;i++)
{
lld b=*it*a[i];
if (b<2000000001) s.insert(b);
}
it++;
}
vector<lld> humble(s.begin(),s.end());
int n;
while (scanf("%d",&n)==1)
{
if (n==0) return 0;
string c;
if (n%10==1 && (n%100)/10!=1) c="st";
else if (n%10==2 && (n%100)/10!=1) c="nd";
else if (n%10==3 && (n%100)/10!=1) c="rd";
else c="th";
printf("The %d%s humble number is %lld.\n",n,c.c_str(),humble[n-1]);
}
return 0;
}
Comments
Post a Comment