### 1997 Canadian Computing Competition, Stage 1

## Problem B: Nasty Numbers

We will call a positive integer "nasty" if it has at least two pairs of positive integer factors such that the difference of one pair equals the sum of the other pair.

For example, 6 is nasty since 6 x 1 = 6, 2 x 3 = 6, 6 - 1 = 2 + 3; and 24 is also nasty since 12 - 2 = 6 + 4.

Write a program which accepts as input a list of positive integers and determines if each one is nasty or not.

### Input

The input is a list of positive integers, one per line. The first number in the list is the number of integers to be tested, and is at most 20. The integers to be tested are all less than 32001.

### Output

The output should contain one line for each test value. Each line is to contain the test value and whether or not it is nasty.

### Sample Input

4 6 24 30420 10078

### Sample Output

6 is nasty 24 is nasty 30420 is nasty 10078 is not nasty

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Sep 28, 2008

**Problem Types:**[Show]

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

magicalsoupon Feb 14, 2018 - 9:52:47 pm UTC is my solution cheating?