主页
试题仓库
题目列表
试题分类
经典教材
作业竞赛
作业列表
判题队列
图灵学院
TuringMOOC
图灵书屋
图灵商城
图灵实验室
图灵会员
荣誉成绩
捐赠支持
图灵云编译器
用户/排名
AOJ排名
实名认证
请登录
常用链接
AOJ考试平台
老赵的Gitee代码
编译原理模拟考试平台
Java技术手册
FCC网站
菜鸟网
在线工具箱
字节豆包GPT
代码可视化
力扣网
牛客网
洛谷
杭电OJ
CodeForce
隐藏编译器
Problem 2877 --1.4.3 Arithmetic Progressions
2877: 1.4.3 Arithmetic Progressions
上一题
正确率: $0.00\%$
下一题
Time Limit
$1$ 秒/Second(s)
Memory Limit
$512$ 兆字节/Megabyte(s)
提交总数
$0$
正确数量
$0$
"
裁判形式
标准裁判/Standard Judge
我的状态
尚未尝试
难度
分类标签
usaco
×
为本题添加算法分类(请不要超过5个)
当前分类(单击移除):
usaco
单击选择分类:
Description
<p> An arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0,1,2,3,... . For this problem, a is a non-negative integer and b is a positive integer. </p> <p> Write a program that finds all arithmetic progressions of length n in the set S of bisquares. The set of bisquares is defined as the set of all integers of the form p<sup>2</sup> + q<sup>2</sup> (where p and q are non-negative integers). </p> <h3> <br /> </h3>
Input
<table border="1"> <tbody> <tr> <td> Line 1: </td> <td> N (3 <= N <= 25), the length of progressions for which to search </td> </tr> <tr> <td> Line 2: </td> <td> M (1 <= M <= 250), an upper bound to limit the search to the bisquares with 0 <= p,q <= M. </td> </tr> </tbody> </table>
Output
<p> If no sequence is found, a singe line reading `NONE'. Otherwise, output one or more lines, each with two integers: the first element in a found sequence and the difference between consecutive elements in the same sequence. The lines should be ordered with smallest-difference sequences first and smallest starting number within those sequences first. </p> <p> There will be no more than 10,000 sequences. </p>
Sample Input
5 7
Sample Output
1 4 37 4 2 8 29 8 1 12 5 12 13 12 17 12 5 20 2 24
推荐代码
查看2877 所有题解
上传题解视频得图灵币
本题记录
用 户(点击查看用户)
运行号(点击购买题解)
时 间
算法最快[$0 $ms]
0
内存最少[$0 $KB]
0
第一AC
0
第一挑战
0
赛题来源
usaco training
usaco Training
登录后提交代码
题面与样例可直接查看,登录后即可在线提交和评测。
前往登录