MODULUS2 - BF_MODULUS

no tags 

 

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


hide comments
Mitch Schwartz: 2013-05-27 03:59:39

@Jitesh: Look for -1.

Jitesh: 2013-05-27 03:59:39

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..

Mostafa 36a2: 2013-05-27 03:59:39

@Mitch Schwartz thanks Man :))
my code was 610 char..but this EOF make it 1144 .. any way..thanks again :)

Mitch Schwartz: 2013-05-27 03:59:39

@Mostafa: Yes that's right. It's made clear in the comments but not in the problem statement.

Mostafa 36a2: 2013-05-27 03:59:39

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?

(Tjandra Satria Gunawan)(曾毅昆): 2013-05-27 03:59:39

@cegprakash: can you tell me why my code getting Wrong Answer (ID: 7366784)?

Last edit: 2012-07-24 14:10:34
cegprakash: 2013-05-27 03:59:39

@Jitesh: there are no other characters after the last test case

Jitesh: 2013-05-27 03:59:39

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
Jitesh: 2013-05-27 03:59:39

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
cegprakash: 2013-05-27 03:59:39

The input specifications are clearly explained. Which part u can't get in it?


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