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 |
请问到底为什么会是Output Limit Exceed,我查了好久没找到不一样的格式呀#include <stdio.h> #define MAXSHU 100000 char result[MAXSHU][10]; void printresult(int shu) { if(shu>=MAXSHU) shu=MAXSHU-1; for(int i=0;i<10;i++) printf("%c",result[shu][i]); } void makeresult() { double xiaoshu=0; double sum=0; for(int n=1;n<MAXSHU;n++) { xiaoshu=0.5/n; sum+=xiaoshu; result[n][9]=(int)((sum+0.0005)*1000)%10+'0'; result[n][8]=(int)(sum*100)%10+'0'; result[n][7]=(int)(sum*10)%10+'0'; result[n][6]='.'; result[n][5]=(int)sum%10+'0'; result[n][4]=' '; result[n][3]=' '; result[n][2]=' '; result[n][1]=' '; result[n][0]=' '; } } void main() { int shu; int n=0; makeresult(); printf("Cards Overhang\n"); while(scanf("%d",&shu)) { printf("%5d",shu); printresult(shu); printf("\n"); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator