623 - 500!

All about problems in Volume 6. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 623 - 500!

Post by uDebug »

Replying to follow the thread.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
TLEorWA
New poster
Posts: 12
Joined: Sat Mar 01, 2014 12:56 pm

Re: 623 - 500!

Post by TLEorWA »

when i use java , verdict Runtime Error (RE)...why? :(
Help??
Here is my code
AC
Last edited by TLEorWA on Thu Apr 10, 2014 1:39 pm, edited 1 time in total.
lbv
Experienced poster
Posts: 128
Joined: Tue Nov 29, 2011 8:40 am

Re: 623 - 500!

Post 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.
TLEorWA
New poster
Posts: 12
Joined: Sat Mar 01, 2014 12:56 pm

Re: 623 - 500!

Post by TLEorWA »

thnks lbv .Accepted :D
Catherine Fang
New poster
Posts: 1
Joined: Thu Jul 31, 2014 12:52 pm

Re: 623 - 500! WA.Help!

Post 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);
}
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 623 - 500!

Post by brianfry713 »

http://www.udebug.com/UVa/623
Click "Critical Input", then "Go!"
Check input and AC output for thousands of problems on uDebug!
xrenon
New poster
Posts: 10
Joined: Tue Sep 23, 2014 4:11 am

Re: 623 - 500!

Post by xrenon »

Deleted
Thank you
Last edited by xrenon on Wed Oct 22, 2014 3:08 pm, edited 1 time in total.
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 623 - 500!

Post 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)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Post Reply

Return to “Volume 6 (600-699)”