Page 10 of 19

Re: stupid......problem.

Posted: Tue Feb 26, 2008 12:09 pm
by helloneo
Obaida wrote:Now look at my output.... I thik thats good.... but still WA
Actually your code prints output this way.. :-)

\n
2\n
\n
3\n
2\n
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n
\n
3\n
2\n
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n

Strange....

Posted: Tue Feb 26, 2008 12:36 pm
by Obaida
I think I can't read you.... still WA....
look at my code...... what should be edited...

Code: Select all

Removed

Posted: Thu Feb 28, 2008 4:18 pm
by AcmNightivy
I change in using stdio..but still WA..Help!!Thanks!!

Code: Select all

#include <stdio.h>

int main ()
{
	int i, j, k;
	int caseNum;
	int a, f;
	char num[10][10] = {"", "1", "22", "333", "4444", "55555", "666666", "7777777", "88888888", "999999999"};

	scanf ("%d", &caseNum);

	for (i = 0; i < caseNum; i++)
	{
		scanf ("%d%d", &a, &f);

		for (j = 0; j < f; j++)
		{
			for (k = 1; k <= a; k++)
			{
				printf ("%s\n", num[k]);
			}
			k = k - 2;
			for (; k >= 1; k--)
			{
				printf ("%s\n", num[k]);
			}

			//if (i != caseNum - 1)
			printf ("\n");
		}	
	}
	return 0;
}

Still WA....

Posted: Sat Mar 01, 2008 6:07 am
by Obaida
Some one please could tell me from my above code... that where is the extra \n in my program.... I couldn't find it.... But still I had to belive because I am getting WA in this problem...... :cry:

Posted: Sat Mar 01, 2008 9:52 am
by CSEDU_1323
hi,
Obaida, helloneo trace out ur error u print a extra new line in d front

use if(l>= 1 &&l<n)
instead if(l>= 0 &&l<n)
will do ur work

&&

u don't need 2 take test case more than once

HOPE THIS HELPS

Yes...

Posted: Sat Mar 01, 2008 12:12 pm
by Obaida
Thank You very much.....! I got Accepted..... But in the instruction of the program it is mentoned that we had to print a blank line after test case....
But afterall thank you.... very much....

Re: 488 - PRESENTATION ERROR!

Posted: Thu Apr 17, 2008 3:03 am
by pwilt
I seem to be getting the answer correct (tried to follow the formatting in the other posts to the letter) but I'm still getting WA from the judge. Can anybody point out something that I've missed?

Code: Select all

#include <iostream>
#include <string>

using namespace std;

int main(){
    int tc;
    cin >> tc;
    string nums[9] = {"1","22","333","4444","55555","666666","7777777","88888888","999999999"};
    
    short amp, freq, j;
    
    for (int i = 1; i <= tc; i++){
        cin >> amp;
        cin >> freq;
        
        for (short k = 1; k <= freq; k++){
            for (j = 0; j < amp; j++){
                cout << nums[j] << endl;
            }
            for (j -= 2; j >= 0; j--){
                cout << nums[j] << endl;
            }
            if (k < freq){
                cout << endl;
            }
        }
        if (i < tc){
            cout << endl;
        }
    }
}

Re: 488 - PRESENTATION ERROR!

Posted: Sat Apr 19, 2008 3:54 am
by pwilt
Bump?

Re: 488 TLE

Posted: Sun Apr 20, 2008 4:57 pm
by t_sergiu
I am getting a TLE on this problem as well. I would think it wouldn't take any time at all to run this. Can anybody offer some suggestions?

Re: 488 TLE

Posted: Sun Apr 20, 2008 5:47 pm
by Jan
No idea. Are you sure you are taking input correctly? You can check your solution by sending a solution which just takes the input.

Re: 488 TLE

Posted: Sun Apr 20, 2008 6:34 pm
by t_sergiu
Fixed. I was using cin and cout. Switched it to use printf and scanf, and did it in 1/10 of a second.

Re: 488 - PRESENTATION ERROR!

Posted: Tue Apr 22, 2008 9:45 am
by Obaida
But this is Actually WA...!
Not PE... :o
In "int main()" type you should use "return 0;"
But you didn't do it.

Re: 488 TLE

Posted: Tue May 27, 2008 12:27 pm
by hahahaken
My code got time limit exceeded.
How to reduce the time? Coz I don't know the maximum number of input.

Code: Select all

Removed after AC

Re: 488 TLE

Posted: Wed May 28, 2008 8:34 am
by Obaida
If you use array then you can solve the problem by pre-initialization, it can be like:

Code: Select all

int use[10]={0,1,22,333,4444,55555,666666,7777777,88888888,999999999};
then just print the current value of use[i] and make the wave. It will be more faster and efficient.

else you can do it without any use of array then it can be a little slow.

>>may this help you. :wink:

Re: 488 TLE

Posted: Wed May 28, 2008 9:54 am
by hahahaken
Obaida wrote:If you use array then you can solve the problem by pre-initialization, it can be like:

Code: Select all

int use[10]={0,1,22,333,4444,55555,666666,7777777,88888888,999999999};
then just print the current value of use[i] and make the wave. It will be more faster and efficient.

else you can do it without any use of array then it can be a little slow.

>>may this help you. :wink:
Still TLE
Here's the updated version:

Code: Select all

Removed after AC