1 注意数的大小
2 注意输出时111,112这些数字
#include<iostream>
#include<fstream>
#include<algorithm>
#define M 2000000000
using namespace std;
int a[6000];
int main(){
int len=0;
long long num2=1,num3=1,num5=1,num7=1;
while(num2<=M){
while(num2*num3<=M){
while(num2*num3*num5<=M){
while(num2*num3*num5*num7<=M){
a[len++]=num2*num3*num5*num7;
num7*=7;
}
num5*=5;
num7=1;
}
num3*=3;
num5=1;
}
num2*=2;
num3=1;
}
sort(a,a+len);
int n;
//fstream cin("1.txt");
while(cin>>n&&n!=0){
if(n%10==1){
if(n%100==11){
cout<<"The "<<n<<"th humble number is "<<a[n-1]<<"."<<endl;
}else{
cout<<"The "<<n<<"st humble number is "<<a[n-1]<<"."<<endl;
}
}else if(n%10==2){
if(n%100==12){
cout<<"The "<<n<<"th humble number is "<<a[n-1]<<"."<<endl;
}else{
cout<<"The "<<n<<"nd humble number is "<<a[n-1]<<"."<<endl;
}
}else if(n%10==3){
if(n%100==13){
cout<<"The "<<n<<"th humble number is "<<a[n-1]<<"."<<endl;
}else{
cout<<"The "<<n<<"rd humble number is "<<a[n-1]<<"."<<endl;
}
}else{
cout<<"The "<<n<<"th humble number is "<<a[n-1]<<"."<<endl;
}
}
return 0;
}