// Header file begin
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<cctype>
#include<sstream>
#include<set>
#include<list>
#include<stack>
#include<utility>
#include<queue>
#include<algorithm>
#include<cstdlib>
// End
//..........
// Macro
#define sf scanf
#define pf printf
#define lp1(i,n) for(i=0;i<n;i++)
#define lp2(i,n) for(i=1;i<=n;i++)
#define mset(c,v) memset(c,v,sizeof(c))
#define cp(a) cout<<" "<<a<<" "
#define nl puts("")
#define sq(x) ((x)*(x))
#define all(x) x.begin(),x.end()
#define reall(x) x.rbegin(),x.rend()
#define s_wap(x,y) x^=y;y^=x;x^=y;
#define sz size()
#define gc getchar()
#define pb push_back
#define freader freopen("input.txt","r",stdin)
// End.........
// Size
#define mx7 20000100
#define mx6 1500000
#define mx5 100005
#define mx4 1000100
#define inf 1<<30 //infinity value
#define eps 1e-9
#define mx (65540)
#define mod 1000000007
#define pi acos(-1.0)
// Macros for Graph
#define white 1
#define gray 2
#define black 3
#define nil 0
using namespace std;
/***************/
// typedef
typedef long long LL;
typedef long L;
typedef unsigned long long ull;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int>vi;
typedef vector<long long> vll;
typedef vector<long>vl;
typedef vector<char>vch;
typedef vector<string>vs;
typedef map<int,int>mpii;
typedef map<int,bool>mpbi;
typedef map<long,bool>mpbl;
typedef map<long long,bool>mpbll;
typedef map<char,int>mpci;
typedef map<char,bool>mpbc;
typedef map<string,int>mpsi;
typedef map<long long,long long>mpll;
// template
template<class T> T gcd(T a, T b ) {return b!=0?gcd<T>(b,a%b):a;}
template<class T> T large(T a, T b ) {return a>b?a:b;}
template<class T> T small(T a, T b ) {return a<b?a:b;}
template<class T> T diffrnce(T a, T b) {return a-b<0?b-a:a-b;}
int digit(int n)
{
return n%10;
}
void chk(int num)
{
switch(digit(num))
{
case 1:
pf("st");
break;
case 2:
pf("nd");
break;
case 3:
pf("rd");
break;
default:
pf("th");
break;
}
}
int main()
{
set<LL>h;
h.insert(1);
set<LL>::iterator it=h.begin();
while(h.size() < 7500)
{
h.insert(*it * 2);
h.insert(*it * 3);
h.insert(*it * 5);
h.insert(*it * 7);
*it++;
}
vector<LL>v(h.begin(),h.end());
//for(int i=0;i<10;i++)cout<<v[i]<<" ";
char ch[10];
while(~sf("%s",&ch))
{
int len=strlen(ch),num;
num = atoi(ch);
if(!num)break;
pf("The %d",num);
if(len<=1)
{
switch(digit(num))
{
case 1:
pf("st");
break;
case 2:
pf("nd");
break;
case 3:
pf("rd");
break;
default:
pf("th");
break;
}
}
else
{
switch(ch[len-2])
{
case '0':
chk(num);
break;
case '1':
pf("th");
break;
case '2':
chk(num);
break;
case '3':
chk(num);
break;
case '4':
chk(num);
break;
case '5':
chk(num);
break;
case '6':
chk(num);
break;
case '7':
chk(num);
break;
case '8':
chk(num);
break;
case '9':
chk(num);
break;
default:
break;
}
}
pf(" humble number is %lld.\n",v[num-1]);
}
return 0;
}
Comments
Post a Comment