Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

itoa不能用吗?为什么会CE?

Posted by wenshameng at 2009-08-28 00:50:05 on Problem 1019
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
int t,n,s,p,l;
char st[15]; 
int main()
{
	scanf("%d",&t);
	while (t>0)
	{
		t--;
		scanf("%d",&n);
		p=0;
		s=0;
		while (n>0)
		{
			p++;
			itoa(p,st,10);
			l=strlen(st);
			s+=l;
			n-=s;
		}
		n+=s;
		p=0;
		s=0;
		while (n>0)
		{
            p++;
			itoa(p,st,10);
			l=strlen(st);
			n-=l;
		}
		n+=l;
	    printf("%c\n",st[n-1]);
	}
	return 0;
}


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator