Page 1 of 1

Posted: Thu Jan 10, 2002 10:24 am
by suman
I used
Input
-----
009
aa
27
1
10
0
26
z
78
bz
52
az
104
cz
728
aaz
29697684282993
transcendental
28011622636823854456520
computationally
zzzzzzzzzzzzzzzzzzzz
157118051752
eclectic
perspective
35672211599026729
a
c
b
z
*

and output
----------
i 009
aa 27
aa 27
a 1
j 10
z 0
z 26
z 26
bz 78
bz 78
az 52
az 52
cz 104
cz 104
aaz 728
aaz 728
elementary 29,697,684,282,993
transcendental 51,346,529,199,396,181,750
prestidigitation 28,011,622,636,823,854,456,520
computationally 232,049,592,627,851,629,097
zzzzzzzzzzzzzzzzzzzz 20,725,274,851,017,785,518,433,805,270
snowfall 157,118,051,752
eclectic 41,230,726,085
perspective 2,289,737,544,193,013
irrationally 35,672,211,599,026,729
a 1
c 3
b 2
z 26


But still wa


Please help
- Suman

Posted: Thu Jan 10, 2002 10:26 am
by suman
Pervious message was reformated by the board
trying this
output
------

i 009
aa 27
aa 27
a 1
j 10
z 0
z 26
z 26
bz 78
bz 78
az 52
az 52
cz 104
cz 104
aaz 728
aaz 728
elementary 29,697,684,282,993
transcendental 51,346,529,199,396,181,750
prestidigitation 28,011,622,636,823,854,456,520
computationally 232,049,592,627,851,629,097
zzzzzzzzzzzzzzzzzzzz 20,725,274,851,017,785,518,433,805,270
snowfall 157,118,051,752
eclectic 41,230,726,085
perspective 2,289,737,544,193,013
irrationally 35,672,211,599,026,729
a 1
c 3
b 2
z 26

Posted: Sun Jan 20, 2002 1:40 pm
by Ivan Golubev
I've also got WA on this problem after rejudgement. And I suspect that there something wrong with input. Can somebody comment it?

Posted: Sat Jun 22, 2002 2:41 am
by Sherman MXF
I got Accepted. I think there is no leading zeros in the input.
Good luck.

Posted: Sat Jun 22, 2002 7:51 am
by Ivan Golubev
There was a capital letter(s) in input. That was fixed and rejudged several monthes ago, now everything OK.

619.....plz....help........

Posted: Tue Feb 11, 2003 4:16 pm
by ffkre
how can i get the input 20,725,274,851,017,785,518,433,805,270?
i can't get it by long long........
any data type can do this?
thx~

Posted: Tue Feb 11, 2003 5:57 pm
by Dominik Michniewski
any type of data doesn't handle such big input value ....
you must try to write your own version of BigInteger :)) as strings mabe ;-)

Dominik

Posted: Wed Feb 12, 2003 11:21 am
by ffkre
how can declare the own strcuture ?
can u tell me how to do it?

Re: 619

Posted: Mon Feb 17, 2003 2:45 pm
by TWEmp
ffkre wrote:how can declare the own strcuture ?
can u tell me how to do it?
Strings are character arrays in C. This makes
manipulation on extremely big integers by string
easier.

For this question, you can consider the steps of
long division which helps the whole number handling
a lot.

Meanwhile, I get accepted HERE for this question but I get
Array Index Out Of Bound Error somewhere else. I'd like
to obtain some useful test cases in order to tackle my
problem.

619---Wrong Answer

Posted: Tue May 11, 2004 3:19 pm
by steve4760

Code: Select all

/* This is my code,I got WA many times.Please help me!!! */
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int diff(long matrix1[11],long matrix2[11])
{
	long i,j;
	i=10;
	while(matrix1[i]==0)
		i--;
	j=10;
	while(matrix2[j]==0)
		j--;
	if(i>j)
		return 0;
	else if(i==j)
	{
		for(;i>=0;i--)
		{
			if(matrix1[i]>matrix2[i])
			{
				return 0;
				break;
			}
			else if(matrix1[i]<matrix2[i])
			{
				return 1;
				break;
			}
		}
	}
	else
		return 1;
}
void main()
{
	char input[50];
	long carry,count,inputl,i,j,k,num[11],tmp1[11],ts[21][11]={0},limit[21][11]={0};
	ts[0][0]=limit[0][0]=1;
	for(i=1;i<21;i++)
	{
		carry=j=0;
		while(ts[i-1][j]!=0)
		{
			ts[i][j]=ts[i-1][j]*26+carry;
			carry=ts[i][j]/1000;
			ts[i][j]=ts[i][j]%1000;
			j++;
		}
		ts[i][j]+=carry;
	}
	for(i=1;i<21;i++)
	{
		carry=j=0;
		while(ts[i][j]!=0)
		{
			limit[i][j]=limit[i-1][j]+ts[i][j]+carry;
			carry=limit[i][j]/1000;
			limit[i][j]=limit[i][j]%1000;
			j++;
		}
		limit[i][j]+=carry;
	}
	while(scanf(" %s",input)==1)
	{
		for(i=0;i<11;i++)
			num[i]=tmp1[i]=0;
		if(input[0]=='*')
			break;
		else if(isalpha(input[0])!=0)
		{
			inputl=strlen(input);
			for(i=0;i<inputl;i++)
			{
				carry=j=0;
				while(ts[inputl-i-1][j]!=0 || num[j]!=0)
				{
					if(input[i]>='a' && input[i]<='z')
						num[j]+=ts[inputl-i-1][j]*(input[i]-'a'+1)+carry;
					else if(input[i]>='A' && input[i]<='Z')
						num[j]+=ts[inputl-i-1][j]*(input[i]-'A'+1)+carry;
					carry=num[j]/1000;
					num[j]=num[j]%1000;
					j++;
				}
				num[j]+=carry;
			}
		}
		else
		{
			inputl=strlen(input);
			for(i=0;i<inputl;i++)
			{
				num[0]=tmp1[0]=num[0]*10+(input[i]-'0');
				if(num[0]>=1000)
				{
					carry=num[0]/1000;
					num[0]=tmp1[0]=num[0]%1000;
				}
				j=1;
				while(j<=i/3)
				{
					num[j]=tmp1[j]=num[j]*10+carry;
					carry=num[j]/1000;
					num[j]=tmp1[j]=num[j]%1000;
					j++;
				}
			}
			i=20;
			while(diff(tmp1,limit[i])!=0)
				i--;
			for(k=0;i>=0;i--,k++)
			{
				count=0;
				while(diff(tmp1,limit[i])==0)
				{
					for(j=0;j<11;j++)
					{
						tmp1[j]=tmp1[j]-ts[i][j];
						if(tmp1[j]<0)
						{
							tmp1[j+1]-=1;
							tmp1[j]+=1000;
						}
					}
					count++;
				}
				input[k]=count-1+'a';
			}
			input[k]='\0';
			inputl=strlen(input);
		}
		printf("%s",input);
		for(i=inputl+1;i<23;i++)
			printf(" ");
		i=10;
		while(num[i]==0)
			i--;
		printf("%ld",num[i]);
		if(i>0)
			printf(",");
		for(i=i-1;i>=0;i--)
		{
			if(num[i]<10)
				printf("00%ld",num[i]);
			else if(num[i]<100)
				printf("0%ld",num[i]);
			else
				printf("%ld",num[i]);
			if(i!=0)
				printf(",");
		}
		printf("\n");
	}
}

Re: 619 - Numerically Speaking

Posted: Mon Nov 23, 2015 2:54 am
by oja
why am i getting RE? I tried udebug with both upper and lower bound inputs and my code works..

Code: Select all

got AC, code deleted
EDIT: I got multiple REs just because the name of the main class isn't "Main"!!