MODULUS2 - BF_MODULUS

 

See also http://www.spoj.com/problems/PROBLEM1/

 

 

Problem

Given an integer n print all the possibilities of a%n.

Input

The first line consists of an integer t, the number of test cases followed by t lines containing an integer n.

Output

For each test case print all the possibilities of a%n in descending order separated by a single space. After each test case print a new line character. If there are no possibilities print "NOT POSSIBLE".

 

Input specifications:

0<t<=100

0<=N<=100

Time limit: 1 second

Example

 

Sample Input

2

1

2

 

Sample Output

0

1 0


Added by:cegprakash
Date:2011-03-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BF

hide comments
2013-05-27 03:59:39 Mitch Schwartz
@Jitesh: Look for -1.
2013-05-27 03:59:39 Jitesh
Can someone tell me how to check for EOF.
I tried a lot of methods on Ideone but still I'm unable to get it..
2013-05-27 03:59:39 Mostafa 36a2
@Mitch Schwartz thanks Man :))
my code was 610 char..but this EOF make it 1144 .. any way..thanks again :)
2013-05-27 03:59:39 Mitch Schwartz
@Mostafa: Yes that's right. It's made clear in the comments but not in the problem statement.
2013-05-27 03:59:39 Mostafa 36a2
TLE!!!
I check my code for all test cases
from 0 to 100 works perfectly 0.02s on ideone ..
i think there is no \n after the last input... am i right?
2013-05-27 03:59:39 (Tjandra Satria Gunawan)(曾毅昆)
@cegprakash: can you tell me why my code getting Wrong Answer (ID: 7366784)?

Last edit: 2012-07-24 14:10:34
2013-05-27 03:59:39 cegprakash
@Jitesh: there are no other characters after the last test case
2013-05-27 03:59:39 Jitesh
Is there any extra character at the end of line......Getting a TLE again and again......And its just because of input....Otherwise logic wise I don't think it'll give me a TLE.......Please help........
@ cegprakash: Check my submission #6072223

Last edit: 2011-11-23 05:33:10
2013-05-27 03:59:39 Jitesh
I'm assuming two '\n's after every test case and only one for the last case and its running fine on my PC but getting a TLE here......
cegprakash says: why are you assuming two '\n's?

Last edit: 2012-03-27 04:18:39
2013-05-27 03:59:39 cegprakash
The input specifications are clearly explained. Which part u can't get in it?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.