Page 13 of 13

Re: 623 - 500!

Posted: Sat Apr 05, 2014 3:00 pm
by uDebug
Replying to follow the thread.

Re: 623 - 500!

Posted: Thu Apr 10, 2014 5:07 am
by TLEorWA
when i use java , verdict Runtime Error (RE)...why? :(
Help??
Here is my code
AC

Re: 623 - 500!

Posted: Thu Apr 10, 2014 7:50 am
by lbv
TLEorWA wrote:when i use java , verdict Runtime Error (RE)...why? :(
A few things for you to consider:
  • As mentioned in previous posts, Java programs for the UVa judge must have a class named Main (notice the capital M).
  • Have you tried your program with an actual input file? When I tested your program locally it resulted in a java.util.NoSuchElementException, which is not surprising considering that your code apparently expects a never ending stream of test cases (lines 8-9).
  • Even after fixing the above minor issues, your program is likely to result in TLE. This problem seems to require some amount of memoization.
I suggest you take the time to carefully read the previous messages in this thread; you'll find very valuable information.

Re: 623 - 500!

Posted: Thu Apr 10, 2014 1:39 pm
by TLEorWA
thnks lbv .Accepted :D

Re: 623 - 500! WA.Help!

Posted: Mon Sep 08, 2014 2:57 am
by Catherine Fang
Why WA...?
I have passed the given data..
Thanks.

Code: Select all


#include <cstring>
#include <stdio.h>
#include <string>
using namespace std;

const int maxn = 3000;
int f[3000];
string s[1010];
int len;

void save(int index)
{
	for(int i=len;i>=0;i--)
	{
		s[index] += char(f[i]+'0');
		
	}
	
}
int main()
{
	int m;
	freopen("1.txt","r",stdin);

	memset(f,0,sizeof(f));
	f[0]=1;
	len = 0;
	for(int i=2;i<=1000;i++)
	{
		int c = 0;
		int ans;
		for(int j=0;j<maxn;j++)
		{
			ans = f[j] * i+c;
			f[j]= ans%10;
			c = ans/10;
			if(f[j])
				len = j;
			
		}
		save(i);
	}

	
	while(scanf("%d",&m)!=EOF)
	{

		printf("%d!\n",m);
		printf("%s\n",s[m].c_str());
	}



	while(1);
}

Re: 623 - 500!

Posted: Mon Sep 08, 2014 8:23 pm
by brianfry713
http://www.udebug.com/UVa/623
Click "Critical Input", then "Go!"

Re: 623 - 500!

Posted: Wed Oct 22, 2014 2:20 pm
by xrenon
Deleted
Thank you

Re: 623 - 500!

Posted: Wed Oct 22, 2014 2:46 pm
by lighted
Use code tags. You could try critical input as mentioned above.

Input

Code: Select all

0
Acc Output

Code: Select all

0!
1
Don't forget to remove your code after getting accepted. 8)