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 |
打表咯 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈#include <stdlib.h> #include<iostream> using namespace std; int main) { int n; while(cin>>n) { if(n==0)break; if(n==1){printf("1\n");continue;} if(n==2){printf("1 2\n");continue;} if(n==4||n==8||n==16||n==32||n==64) { printf("1 2 "); for(int i=4;i<=n;i=i*2) printf("%d ",i); printf("\n"); } else { switch(n) { case 3:printf("1 2 3\n");break; case 5:printf("1 2 3 5\n");break; case 6: printf("1 2 3 6\n");break; case 7:printf("1 2 3 4 7\n");break; case 9:printf("1 2 3 6 9\n");break; case 10:printf("1 2 3 5 10\n");break; case 11:printf("1 2 3 4 7 11\n");break; case 12:printf("1 2 3 6 12\n");break; case 13:printf("1 2 3 5 8 13\n");break; case 14:printf("1 2 3 4 7 14\n");break; case 15:printf("1 2 3 5 10 15\n");break; case 17:printf("1 2 4 8 9 17\n");break; case 18:printf("1 2 3 6 9 18\n");break; case 19:printf("1 2 3 4 8 11 19\n");break; case 20:printf("1 2 3 5 10 20\n");break; case 21:printf("1 2 3 4 7 14 21\n");break; case 22:printf("1 2 3 4 7 11 22\n");break; case 23:printf("1 2 3 5 10 13 23\n");break; case 24:printf("1 2 3 6 12 24\n");break; case 25:printf("1 2 3 5 10 15 25\n");break; case 26:printf("1 2 3 5 8 13 26\n");break; case 27:printf("1 2 3 6 9 18 27\n");break; case 28:printf("1 2 3 4 7 14 28\n");break; case 29:printf("1 2 3 4 7 11 18 29\n");break; case 30:printf("1 2 3 5 10 15 30\n");break; case 31:printf("1 2 3 4 7 14 17 31\n");break; case 33:printf("1 2 4 8 16 17 33\n");break; case 34:printf("1 2 4 8 9 17 34\n");break; case 35:printf("1 2 3 4 7 14 21 35\n");break; case 36:printf("1 2 3 6 9 18 36\n");break; case 37:printf("1 2 3 5 8 16 21 37\n");break; case 38:printf("1 2 3 4 8 11 19 38\n");break; case 39:printf("1 2 3 5 8 13 26 39\n");break; case 40:printf("1 2 3 5 10 20 40\n");break; case 41:printf("1 2 3 5 10 20 21 41\n");break; case 42:printf("1 2 3 4 7 14 21 42\n");break; case 43:printf("1 2 3 5 10 20 23 43\n");break; case 44:printf("1 2 3 4 7 11 22 44\n");break; case 45:printf("1 2 3 5 10 15 30 45\n");break; case 46:printf("1 2 3 5 10 13 23 46\n");break; case 47:printf("1 2 3 4 7 10 20 27 47\n");break; case 48:printf("1 2 3 6 12 24 48\n");break; case 49:printf("1 2 3 6 12 24 25 49\n");break; case 50:printf("1 2 3 5 10 15 25 50\n");break; case 51:printf("1 2 3 6 12 24 27 51\n");break; case 52:printf("1 2 3 5 8 13 26 52\n");break; case 53:printf("1 2 3 5 6 12 24 29 53\n");break; case 54:printf("1 2 3 6 9 18 27 54\n");break; case 55:printf("1 2 3 4 7 11 22 33 55\n");break; case 56:printf("1 2 3 4 7 14 28 56\n");break; case 57:printf("1 2 3 4 7 14 28 29 57\n");break; case 58:printf("1 2 3 4 7 11 18 29 58\n");break; case 59:printf("1 2 3 4 7 14 28 31 59\n");break; case 60:printf("1 2 3 5 10 15 30 60\n");break; case 61:printf("1 2 3 5 7 14 28 33 61\n");break; case 62:printf("1 2 3 4 7 14 17 31 62\n");break; case 63:printf("1 2 3 4 7 14 21 42 63\n");break; case 65:printf("1 2 4 8 16 32 33 65\n");break; case 66:printf("1 2 4 8 16 17 33 66\n");break; case 67:printf("1 2 3 4 8 16 32 35 67\n");break; case 68:printf("1 2 4 8 9 17 34 68\n");break; case 69:printf("1 2 3 5 8 16 32 37 69\n");break; case 70:printf("1 2 3 4 7 14 21 35 70\n");break; case 71:printf("1 2 3 4 7 8 16 32 39 71\n");break; case 72:printf("1 2 3 6 9 18 36 72\n");break; case 73:printf("1 2 3 6 9 18 36 37 73\n");break; case 74:printf("1 2 3 5 8 16 21 37 74\n");break; case 75:printf("1 2 3 5 10 15 25 50 75\n");break; case 76:printf("1 2 3 4 8 11 19 38 76\n");break; case 77:printf("1 2 4 5 9 18 36 41 77\n");break; case 78:printf("1 2 3 5 8 13 26 39 78\n");break; case 79:printf("1 2 3 4 7 9 18 36 43 79\n");break; case 80:printf("1 2 3 5 10 20 40 80\n");break; case 81:printf("1 2 3 5 10 20 40 41 81\n");break; case 82:printf("1 2 3 5 10 20 21 41 82\n");break; case 83:printf("1 2 3 5 10 20 40 43 83\n");break; case 84:printf("1 2 3 4 7 14 21 42 84\n");break; case 85:printf("1 2 3 5 10 20 40 45 85\n");break; case 86:printf("1 2 3 5 10 20 23 43 86\n");break; case 87:printf("1 2 3 4 7 10 20 40 47 87\n");break; case 88:printf("1 2 3 4 7 11 22 44 88\n");break; case 89:printf("1 2 3 4 7 11 22 44 45 89\n");break; case 90:printf("1 2 3 5 10 15 30 45 90\n");break; case 91:printf("1 2 3 4 7 11 22 44 47 91\n");break; case 92:printf("1 2 3 5 10 13 23 46 92\n");break; case 93:printf("1 2 3 4 7 14 17 31 62 93\n");break; case 94:printf("1 2 3 4 7 10 20 27 47 94\n");break; case 95:printf("1 2 3 4 7 11 22 44 51 95\n");break; case 96:printf("1 2 3 6 12 24 48 96\n");break; case 97:printf("1 2 3 6 12 24 48 49 97\n");break; case 98:printf("1 2 3 6 12 24 25 49 98\n");break; case 99:printf("1 2 3 6 12 24 48 51 99\n");break; case 100:printf("1 2 3 5 10 15 25 50 100\n");break; } } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator