H - New Year and the Sphere Transmission

本文探讨了一个球在编号从1到n的人群中按特定规则传递的游戏。通过数学分析,找出所有可能的“趣味值”,即球触及的所有人的编号之和,并按从小到大的顺序列出这些值。文章详细解释了如何确定每次传递的有效步数,以及如何利用等差数列求和公式来计算最终的趣味值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

There are n people sitting in a circle, numbered from 1 to n in the order in which they are seated. That is, for all i from 1 to n−1, the people with id i and i+1 are adjacent. People with id n and 1 are adjacent as well.

The person with id 1 initially has a ball. He picks a positive integer k at most n, and passes the ball to his k-th neighbour in the direction of increasing ids, that person passes the ball to his k-th neighbour in the same direction, and so on until the person with the id 1 gets the ball back. When he gets it back, people do not pass the ball any more.

For instance, if n=6 and k=4, the ball is passed in order [1,5,3,1].

Consider the set of all people that touched the ball. The fun value of the game is the sum of the ids of people that touched it. In the above example, the fun value would be 1+5+3=9.

Find and report the set of possible fun values for all choices of positive integer k. It can be shown that under the constraints of the problem, the ball always gets back to the 1-st player after finitely many steps, and there are no more than 105 possible fun values for given n.

Input
The only line consists of a single integer n (2≤n≤109) — the number of people playing with the ball.

Output
Suppose the set of all fun values is f1,f2,…,fm.

Output a single line containing m space separated integers f1 through fm in increasing order.

Examples
Input
6
Output
1 5 9 21
Input
16
Output
1 10 28 64 136
Note
In the first sample, we’ve already shown that picking k=4 yields fun value 9, as does k=2. Picking k=6 results in fun value of 1. For k=3 we get fun value 5 and with k=1 or k=5 we get 21.

In the second sample, the values 1, 10, 28, 64 and 136 are achieved for instance for k=16, 8, 4, 10 and 11, respectively.

在这里插入图片描述

题意:
由1到n的环从一开始走每次走的个数一样,问再一次走回1所要的权值由小到大排序;
权值=路过的数的和;
首先直接走到自己最小;然后每次走一个最大
是其因子数才能重新走回去
然后就是走n-因子数=因子数
比如n=6
一次走两个或一次走四个;;

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include <iostream>
#include<string.h>     
#include<algorithm>
#define ll long long
#define hengheng main ()
using namespace std;
int cnt=0;
ll ans[100010];
int main()
{
	ll n;
    scanf("%lld",&n);
    for(int i=1;i*i<=n;i++)  //  i为n的因子数,则n/i 也是n的因子数; 
    {
        if(n%i==0)
        {
        	ans[++cnt]=(2+n-i)*(n/i)/2;  // 等差数列 
        	ans[++cnt]=(2+n-n/i)*i/2;
		}
    }
    sort(ans+1,ans+cnt+1);
    for(int i=1;i<=cnt;i++)
        if(ans[i]!=ans[i-1])
        printf("%lld ",ans[i]);
    printf("\n");
    return 0;
}
1. 用户与权限管理模块 角色管理: 学生:查看实验室信息、预约设备、提交耗材申请、参与安全考核 教师:管理课题组预约、审批学生耗材申请、查看本课题组使用记录 管理员:设备全生命周期管理、审核预约、耗材采购与分发、安全检查 用户操作: 登录认证:统一身份认证(对接学号 / 工号系统,模拟实现),支持密码重置 信息管理:学生 / 教师维护个人信息(联系方式、所属院系),管理员管理所有用户 权限控制:不同角色仅可见对应功能(如学生不可删除设备信息) 2. 实验室与设备管理模块 实验室信息管理: 基础信息:实验室编号、名称、位置、容纳数、开放时间、负责 功能分类:按学科(计算机实验室 / 电子实验室 / 化学实验室)标记,关联可开展实验类型 状态展示:实时显示当前使用数、设备运行状态(正常 / 故障) 设备管理: 设备档案:名称、型号、规格、购置日期、单价、生产厂家、存放位置、责任 全生命周期管理: 入库登记:管理员录入新设备信息,生成唯一资产编号 维护记录:记录维修、校准、保养信息(时间、内容、执行) 报废处理:登记报废原因、时间,更新设备状态为 "已报废" 设备查询:支持按名称、型号、状态多条件检索,显示设备当前可用情况 3. 预约与使用模块 预约管理: 预约规则:学生可预约未来 7 天内的设备 / 实验室,单次最长 4 小时(可设置) 预约流程:选择实验室→选择设备→选择时间段→提交申请(需填写实验目的) 审核机制:普通实验自动通过,高危实验(如化学实验)需教师审核 使用记录: 签到 / 签退:到达实验室后扫码签到,离开时签退,系统自动记录实际使用时长 使用登记:填写实验内容、设备运行情况(正常 / 异常),异常情况需详细描述 违规管理:迟到 15 分钟自动取消预约,多次违规限制预约权限 4. 耗材与安全管理模块 耗材管理: 耗材档案:名称、规格、数量、存放位置、
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值