www.pudn.com > zhejiang_university_acm_onlinejudge_code.rar > zp1095.cpp


//--------------------------------------------------------------------------- 
 
#pragma hdrstop 
 
//--------------------------------------------------------------------------- 
 
#pragma argsused 
#include  
#include  
using namespace std; 
int t,h; 
int p[6000]; 
string str(int n) 
{ 
  if (n%10==1) 
    if (n%100!=11) return "st"; else return "th"; 
  else 
    if (n%10==2) 
      if (n%100!=12) return "nd";else return "th"; 
    else 
      if (n%10==3) 
        if (n%100!=13) return "rd"; else return "th"; 
      else return "th"; 
} 
void doit(int e) 
{ 
  int r,i; 
  r=t; 
  if (p[h]<2100000000/e) 
  { 
    while (p[r]>p[h]*e) r--; 
    if (p[r]r;i--) 
        p[i+1]=p[i]; 
      p[r+1]=p[h]*e; 
      t++; 
    } 
  } 
} 
int main(int argc, char* argv[]) 
{ 
  int i,s; 
 
  h=0; t=4; 
  p[0]=1; 
  p[1]=2; 
  p[2]=3; 
  p[3]=5; 
  p[4]=7; 
  while (h<5850) 
  { 
    h++; 
    doit(2); 
    doit(3); 
    doit(5); 
    doit(7); 
  } 
 
  cin>>i; 
  while (i) 
  { 
    cout<<"The "<>i; 
  } 
  return 0; 
} 
//---------------------------------------------------------------------------