623 - 500!
Moderator: Board moderators
Re: 623 - 500!
when i use java , verdict Runtime Error (RE)...why?
Help??
Here is my code
Help??
Here is my code
AC
Last edited by TLEorWA on Thu Apr 10, 2014 1:39 pm, edited 1 time in total.
Re: 623 - 500!
A few things for you to consider:TLEorWA wrote:when i use java , verdict Runtime Error (RE)...why?
- 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.
Re: 623 - 500!
thnks lbv .Accepted
-
- New poster
- Posts: 1
- Joined: Thu Jul 31, 2014 12:52 pm
Re: 623 - 500! WA.Help!
Why WA...?
I have passed the given data..
Thanks.
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);
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 623 - 500!
http://www.udebug.com/UVa/623
Click "Critical Input", then "Go!"
Click "Critical Input", then "Go!"
Check input and AC output for thousands of problems on uDebug!
Re: 623 - 500!
Deleted
Thank you
Thank you
Last edited by xrenon on Wed Oct 22, 2014 3:08 pm, edited 1 time in total.
Re: 623 - 500!
Use code tags. You could try critical input as mentioned above.
InputAcc Output
Don't forget to remove your code after getting accepted.
Input
Code: Select all
0
Code: Select all
0!
1
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman