Sachin & his Girlfriend
All submissions for this problem are available.
Sachin came to third year of engineering. He researched something on numbers and soon started to love numbers less than 1007, more than his girlfriend. Every number he would encounter, he would divide the number with 1007 and store its remainder, if he has not come across that remainder previously. Soon his girlfriend found this out, so he asks you to help him.
The first line contains an integer T (1<=T<=1000) denoting the number of test cases. The next T lines contains a single integer N (1<=N<=109) representing the number that Sachin encounters.
For every N print the remainder if it is not encountered previously else skip that number.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA|
Fetching successful submissions