Codeforces 577A - Multiplication Table
2024-09-05 14:30:39
Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains numberi × j. The rows and columns are numbered starting from 1.
You are given a positive integer x. Your task is to count the number of cells in a table that contain number x.
Input
The single line contains numbers n and x (1 ≤ n ≤ 105, 1 ≤ x ≤ 109) — the size of the table and the number that we are looking for in the table.
Output
Print a single number: the number of times x occurs in the table.
Examples
input
10 5
output
2
input
6 12
output
4
input
5 13
output
0
Note
A table for the second sample test is given below. The occurrences of number 12 are marked bold.
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long
int main()
{
ll n,x;
while(cin>>n>>x){
int s=;
for(ll i=;i<=n;i++){
if(x%i==&&x<=i*n) s++;
}
cout<<s<<endl;
}
return ;
}
最新文章
- Qt 拷贝文件目录
- 四则运算GUI设计2.0
- python 常见排序实例
- MySQL主从复制(Master-Slave)与读写分离(MySQL-Proxy)实践
- Android项目结构分析
- cocos2d-x之多点触碰初试
- 夺命雷公狗---DEDECMS----23dedecms修改内容页面展示的信息
- (一)SAPI简述
- 使用SQLServer 2008的CDC功能实现数据变更捕获
- [luogu P3801] 红色的幻想乡 [线段树][树状数组]
- 阿里云部署SSL证书详解
- Nginx的虚拟主机配置
- (动规 或 最短路)Help Jimmy(poj 1661)
- activiti流程
- Splash Lua 脚本
- mysql navicat 及命令行 创建、删除数据库
- 使用spring AOP获得session的思路
- CCNA2.0笔记_路由分类
- iptables防火墙工作原理
- nodejs获取ASP.Net WebAPI(IIS Windows验证)