CodeForces - 577A Multiplication Table(水)
2016-04-10 22:24
309 查看
CodeForces
- 577A
Multiplication Table
Submit Status
Description
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 number i × 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.
Sample Input
Input
Output
Input
Output
Input
Output
Hint
A table for the second sample test is given below. The occurrences of number 12 are marked bold.
Source
Codeforces Round #319 (Div. 2)
- 577A
Multiplication Table
Time Limit: 1000MS | Memory Limit: 262144KB | 64bit IO Format: %I64d & %I64u |
Description
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 number i × 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.
Sample Input
Input
10 5
Output
2
Input
6 12
Output
4
Input
5 13
Output
0
Hint
A table for the second sample test is given below. The occurrences of number 12 are marked bold.
Source
Codeforces Round #319 (Div. 2)
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<iostream>
#define INF 0x3f3f3f3f
#define ull unsigned long long
#define long long
#define IN __in64#define N 100010#define M 1000000007
using namespace std;
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
int cnt=0;
for(int i=1;i<=n;i++)
{
if(m%i==0&&m/i<=n)
cnt++;
}
printf("%d\n",cnt);
}
return 0;
}
相关文章推荐
- 【Virtual Studio】.NET Framework 安装失败 发生严重错误
- 统计文件中字符个数BufferedReader BufferedWriter HashMap
- 录入文件路径 拷贝
- javascript学习记录——canvas元素的基本操作
- hadoop SecondNamenode
- 20145312 《Java程序设计》第六周学习总结
- 环球时报:西方媒体如此恨“防火墙” 这很值得玩味
- 如何通过代码实现获取本周周一的日期
- OC阅读笔记十五:"异常安全代码"的内存管理
- 剑指Offer--009-斐波那契数列
- ubuntu增加磁盘
- 键盘录入 写入文件 quit时 结束
- 文件过滤器练习
- 录入5名学生成绩 按总分排序
- LeetCode 之 Binary Tree Right Side View
- 《深入理解计算机系统》课本第七章自学笔记——20135203齐岳
- 计算时钟的夹角
- 延迟加载的理解
- 干货--Redis池化联接和搭建分布式集群
- Android绘图机制与处理技巧-更新中