1 / 6
Feb 2011

in first place
the algorithm is run well and got accepted i am newbie for spoj and dun know what is the problem in this code
what is the problem in taking inputs by this way
i just change the way i am taking inputs:

Removed after AC

  • created

    Feb '11
  • last reply

    Mar '11
  • 5

    replies

  • 175

    views

  • 2

    users

  • 1

    link

You don't need to read the end of line character. Scanf will ignore whitespace. End of lines can be two characters depending on which os the input file is created on.

en.wikipedia.org/wiki/Newline2

I'm not certain that you have the right problem in the title.

Ps: I deleted your other post. Please dont cross post, it wastes everyone's time.

Thx leppy i changed the title
but i tried without scanf the dummy in buffer and still got WA so i am asking about if there is a problem in taking inputs like the way i mentioned above or i must take it in string and change it
btw both codes run great on my compiler and gave me wright outputs
but just the 2nd one accepted

This is how I took input for this problem:[bbone=cpp,120]#include
using namespace std;

int main()
{
int t,n,x;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
for(int i = 0; i < n; i++)
scanf("%d", &x);
for(int i = 0; i < n; i++)
scanf("%d", &x);
}
}
[/bbone]

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 25 16d

Want to read more? Browse other topics in C and C++ or view latest topics.