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

tie ma ~~

Posted by 574904658 at 2012-07-26 16:34:04 on Problem 1565
#include "stdio.h"
#include "string.h"
#include "math.h"

char a[100000];
int main()
{
	int i;
	long sum;
	while (scanf ("%s",a)!=EOF&&a[0]!='0')
	{
		sum=0;
		for(i=0;i<strlen (a);i++)
		{
          sum+=(a[i]-'0')*(pow(2.0,(strlen(a)-i)*1.0)-1);
		}
         printf ("%ld\n",sum);
	}


	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