当前位置:网站首页>1163: SongGe's score splitting (C language)
1163: SongGe's score splitting (C language)
2022-07-24 16:32:00 【Little why】
Description
Brother song came home to help his niece with her winter vacation homework , There is a topic like this , There is an expression 1/k=1/x+1/y.
among x>=y. Brother song wants to know about the known k, What are all the expressions that meet the conditions , Please list them from small to large .
Input
Multiple sets of test data . Each set of test data contains a positive integer k(k<=5000).
Output
For each set of test data, output all expressions , If expression does not exist , The output -1.
Sample Input
Sample Output
#include <stdio.h>
int main()
{
int k,y,s;
while(~scanf("%d",&k)){
s=0;// Whether the record exists
for(y=k+1;y<=2*k;y++){ //k*y/(y-k) Namely x,((k*y)%(y-k))==0 explain x Is an integer , legal
if(((k*y)%(y-k))==0) printf("1/%d=1/%d+1/%d\n",k,k*y/(y-k),y),s=1;
}
if(s==0) printf("-1\n");// No output present -1
}
return 0;
}边栏推荐
- MODIS data WGet Download
- ZBar source code analysis - img_ scanner. c | [email protected]
- Unity 相机自由移动控制
- 1184. Distance between bus stops
- Chapter 2 using API Mgmnt service
- [LeetCode]38.报数——题解(执行用时击败91% ,内存消耗击败 97%)
- 15. ARM embedded system: how to debug single board with PC
- With notes: printing order of synchronous, asynchronous, micro task and macro task
- hping3安装使用
- 1184. 公交站间的距离
猜你喜欢

Multithreading (basic)

Jing Wei PS tutorial: basic part a

Servlet框架(servlet+jsp)+Mysql实现的增删改查+分页(功能包学生信息录入、学生信息增删改查、分页等)

Envi grid resampling

Summary of experience in using.Net test framework xUnit, mstest, specflow

EMQ Yingyun technology was listed on the 2022 "cutting edge 100" list of Chinese entrepreneurs
![[Nanjing Agricultural University] information sharing of postgraduate entrance examination and re examination](/img/1d/550a991385b842a21e2b301725407e.png)
[Nanjing Agricultural University] information sharing of postgraduate entrance examination and re examination

Why should we launch getaverse?

C TCP client form application asynchronous receiving mode

MODIS data WGet Download
随机推荐
.net review the old and know the new: [6] what is LINQ
deepin任务栏消失解决方法
'resultmap'must match' (constructor?, id*, result*, association*, collect problem solving
我们为什么要推出Getaverse?
[leetcode] skillfully use bit operation
MySQL converts strings to numeric types and sorts them
1184. Distance between bus stops
Jupyter uses tips
Qualcomm reconciled with apple and received at least $4.5 billion in settlement fees! Next goal: Huawei!
Minor record
ZBar project introduction and installation configuration| [email protected]
By default, the select drop-down box selects the solution ligerui that the selected attribute does not work
How to realize seamless rotation map? Write it again with native JS
栈与队列——1047. 删除字符串中的所有相邻重复项
How to generate complex flow chart of XMIND
EC200U-CN模块的使用
Envi5.3 open GF-1 WFV data
如何在 PHP 中防止 XSS
Rest style
Cache penetration, cache breakdown, cache avalanche differences and solutions [easy to understand]