# Cycle-13. Finding positive integer solutions to special equations

Source: Internet
Author: User

Cycle-13. A positive integer solution for a special equation (15) time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Zhang Tong Hongyu (Zhejiang University)

The subject requires that all positive integer solutions of the equation x2+y2=n be obtained for any given positive integer n.

Input format:

The input gives a positive integer n (<=10000) in a row.

Output format:

The output equation x2+y2=n all positive integer solutions, of which x<=y. Each group of solutions accounted for 1 rows, and the two numbers were separated by 1 spaces and output in ascending order of X. If there is no solution, the output is "no solution".

Input Sample 1:
`884`
Output Example 1:
`10 2820 22`
Input Sample 2:
`11`
Output Example 2:
`No Solution`
`1#include <stdio.h>2#include <stdlib.h>3#include <math.h>4 intMain ()5 {6     intN;7scanf"%d", &n);8     intx, y, flag =0;9     Doublem =sqrt (n);Ten      for(x =1; X <= m +1; X + +) One     { A          for(y = x; y <= m +1; y++) -         { -             if(x*x + Y*y = =N) the             { -printf"%d%d\n", x, y); -Flag =1; -             } +         } -     } +     if(!flag) Aprintf"No solution\n"); at     return 0; -}`

Cycle-13. Finding positive integer solutions to special equations

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.