
58  The 7th Zhejiang University Programming Contests  1006
The sequence we discuss here is in the form a, a + b, a + 2b, a + 3b, ... where a is a nonnegative integer and b is a positive integer. Your task is to find out all such sequences whose elements are of the form p^{3}+q^{3} where p and q are nonnegative integers. Input: The input consists of multiple test cases. In each case, there're two integers n, m (3 <= n <= 10, 1 <= m <= 50). n, as mentioned above, is the number of terms in sequence, and m is the upper bound of p and q, which means 0 <= p, q <=m. The input will be ended with "0 0" which should not be processed. Output: For each test case, output "Case #:" first. "#" is the number of the case, which starts from 1. If no such sequence was found, simply output "NONE". Otherwise output the sequences in multiple lines, each line contains two integers a and b mentioned above. The sequence with smaller b comes first, if there's a tie, the one with smaller a comes first. Separate two consecutive test cases with a blank line, but Do NOT output an extra blank line after the last one. Sample Input:4 10 9 1 0 0Sample Output: Case 1: 152 64 27 162 Case 2: NONE 