cf 465 A. Fafa and his Company

本文探讨了一个公司如何公平地将员工分配给团队领导的问题。通过数学算法找出可能的团队领导数量,确保每位领导负责相同数量的员工。
A. Fafa and his Company
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among all the employees.

Fafa finds doing this every time is very tiring for him. So, he decided to choose the best l employees in his company as team leaders. Whenever there is a new project, Fafa will divide the tasks among only the team leaders and each team leader will be responsible of some positive number of employees to give them the tasks. To make this process fair for the team leaders, each one of them should be responsible for the same number of employees. Moreover, every employee, who is not a team leader, has to be under the responsibility of exactly one team leader, and no team leader is responsible for another team leader.

Given the number of employees n, find in how many ways Fafa could choose the number of team leaders l in such a way that it is possible to divide employees between them evenly.

Input

The input consists of a single line containing a positive integer n (2 ≤ n ≤ 105) — the number of employees in Fafa's company.

Output

Print a single integer representing the answer to the problem.

Examples
Input
Copy
2
Output
1
Input
Copy
10
Output
3
Note

In the second sample Fafa has 3 ways:

  • choose only 1 employee as a team leader with 9 employees under his responsibility.
  • choose 2 employees as team leaders with 4 employees under the responsibility of each of them.
  • choose 5 employees as team leaders with 1 employee under the responsibility of each of them.

#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef double    dl ;
#define INF 0x7f
const dl maxn =1e3+5; 

#define f(i,l,r) for(int i=l;i<=r;++i)
#define g(i,l,r) for(int i=l;i>=r;--i)
 int n;
int main()
{
     
  //  freopen("in","r",stdin);
    cin>>n;
    int ans=0;
    f(i,1,n>>1)
    {
    	if( n%i==0)
    		ans++;
    }

    cout<<ans<<endl;

    return 0; 
}
未来的我一定会感谢现在正在成长的我











# 关于 `CREATE INDEX idx_name USING BTREE ON afafa(a)` 语句的详细说明 ## 1. 语法解析 您提供的SQL语句是创建B-Tree索引的标准语法: ```sql CREATE INDEX idx_name USING BTREE ON afafa(a) ``` ### 语法要素说明: - `idx_name`:自定义的索引名称(需在表中唯一) - `USING BTREE`:显式指定索引类型为B-Tree(多数数据库的默认类型) - `afafa`:目标表名 - `(a)`:要建立索引的列名(单列) ## 2. 正确写法与变体 ### 标准正确写法(MySQL为例): ```sql -- 基本形式 CREATE INDEX idx_name ON afafa(a); -- 显式指定B-Tree(MySQL可省略,因默认就是BTREE) CREATE INDEX idx_name USING BTREE ON afafa(a); ``` ### 其他数据库变体: ```sql -- PostgreSQL写法 CREATE INDEX idx_name ON afafa USING btree (a); -- SQL Server写法 CREATE INDEX idx_name ON afafa(a); -- 注意:SQL Server没有USING语法,默认使用B-Tree ``` ## 3. 使用注意事项 ### 重要限制条件: 1. **表必须存在**:执行前需确保表`afafa`已创建 2. **列必须存在**:列`a`必须在表`afafa`中定义 3. **权限要求**:需要表的CREATE INDEX权限 ### 性能考虑: - 对大表建索引可能锁表(生产环境建议在低峰期操作) - 可添加`ALGORITHM=INPLACE, LOCK=NONE`参数(MySQL 5.6+)减少锁影响: ```sql CREATE INDEX idx_name ON afafa(a) ALGORITHM=INPLACE, LOCK=NONE; ``` ## 4. 验证索引创建 创建后可通过以下命令验证: ```sql -- MySQL查看索引 SHOW INDEX FROM afafa; -- 通用方法(信息模式查询) SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'afafa'; ``` ## 5. 实际应用示例 ### 场景:用户表查询优化 ```sql -- 原始表结构 CREATE TABLE users ( id INT PRIMARY KEY, username VARCHAR(50), email VARCHAR(100), created_at DATETIME ); -- 为用户名创建索引(加速登录查询) CREATE INDEX idx_username ON users(username); -- 为创建时间创建索引(加速时间范围查询) CREATE INDEX idx_created_at ON users(created_at); ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值