Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么老是Runtime error!!#include <stdio.h> int main(){ int n, humble[5843]; int l2=0, l3=0, l5=0, l7=0, i=0, t1, t2; humble[i]=1; while(i<5844) { t1 = humble[l2] * 2 > humble[l3] * 3 ? humble[l3] * 3 : humble[l2] * 2; t2 = humble[l5] * 5 > humble[l7] * 7 ? humble[l7] * 7 : humble[l5] * 5; humble[++i] = t1 > t2 ? t2 : t1; if((humble[l2] * 2) == humble[i]) l2++; if((humble[l3] * 3) == humble[i]) l3++; if((humble[l5] * 5) == humble[i]) l5++; if((humble[l7] * 7) == humble[i]) l7++; } while(1) { scanf("%d",&n); if ((n < 1) || (n > 5842)) break; else if ((n % 10) == 1) { if ((n % 100) == 11) printf("The %dth humble number is %d.\n", n, humble[n-1]); else printf("The %dst humble number is %d.\n", n, humble[n-1]); } else if ((n % 10) == 2) { if ((n % 100) == 12) printf("The %dth humble number is %d.\n", n, humble[n-1]); else printf("The %dnd humble number is %d.\n", n, humble[n-1]); } else if ((n % 10) == 3) { if ((n % 100) == 13) printf("The %dth humble number is %d.\n", n, humble[n-1]); else printf("The %drd humble number is %d.\n", n, humble[n-1]); } else printf("The %dth humble number is %d.\n", n, humble[n-1]); } printf("yun!\n"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator