A. Multiplication Table

Time Limit: 1 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/577/problem/A

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

10 5

Sample Output

2

HINT

题意

给你n,m,相当于给了你一个n*n的乘法表,然后问你这个乘法表里面有多少个格子等于m

题解:

sqrt暴力枚举因子就好了

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <bitset>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200500
#define mod 1001
#define eps 1e-9
#define pi 3.1415926
int Num;
//const int inf=0x7fffffff;
const ll inf=;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************* int main()
{
int n=read(),x=read();
int ans=;
for(int i=;i<=sqrt(x);i++)
{
if(x%i==)
{
if(i<=n&&x/i<=n)
ans+=;
if(i<=n&&i==x/i)
ans--;
}
}
cout<<ans<<endl;
}

Codeforces Codeforces Round #319 (Div. 2) A. Multiplication Table 水题的更多相关文章

  1. Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon 水题

    A. Watermelon 题目连接: http://www.codeforces.com/contest/4/problem/A Description One hot summer day Pet ...

  2. Codeforces Beta Round #14 (Div. 2) C. Four Segments 水题

    C. Four Segments 题目连接: http://codeforces.com/contest/14/problem/C Description Several months later A ...

  3. Codeforces Beta Round #14 (Div. 2) B. Young Photographer 水题

    B. Young Photographer 题目连接: http://codeforces.com/contest/14/problem/B Description Among other thing ...

  4. Codeforces Beta Round #6 (Div. 2 Only) A. Triangle 水题

    A. Triangle 题目连接: http://codeforces.com/contest/6/problem/A Description Johnny has a younger sister ...

  5. Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)

    转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...

  6. Codeforces Round #256 (Div. 2) D. Multiplication Table 二分法

     D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input st ...

  7. Codeforces Round #256 (Div. 2) D. Multiplication Table 很有想法的一个二分

    D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input stand ...

  8. Codeforces Round #367 (Div. 2) A. Beru-taxi (水题)

    Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b ...

  9. Codeforces Round #334 (Div. 2) A. Uncowed Forces 水题

    A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/pro ...

随机推荐

  1. Linux下执行程序出现 Text file busy 提示时的处理方式

    使用 fuser xxx 命令查看xxx文件被哪个进程占用,然后关闭该进程,解决问题. # fuser xxxxxx:              2878# kill -9 2878 注:xxx是文件 ...

  2. ADT开发中的一些优化设置:代码背景色、代码字体大小、代码自动补全

    初学Android开发,在网上找到一些ADT工具的优化,自己设置好了,截图保存下来.免得以后忘了. 1. 设置背景颜色: 色调85.饱和度90.亮度205 RGB:199.237.204 2. 设置代 ...

  3. IL指令集(转)

    名称 说明 Add 将两个值相加并将结果推送到计算堆栈上. Add.Ovf 将两个整数相加,执行溢出检查,并且将结果推送到计算堆栈上. Add.Ovf.Un 将两个无符号整数值相加,执行溢出检查,并且 ...

  4. 【JS】打印Excel——ActiveX控件

    function viewToExcel(){ var filepath = "f:\\PrinterExcel.xls"; var xlApp; var xlBook; var ...

  5. asp.net微信公众平台开发

    http://mp.weixin.qq.com/wiki/index.php?title=%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E6%8C%87%E5%8D%97 ...

  6. GP(Geoprocessing)服务的发布与调用

    转自:http://www.cnblogs.com/gisangela/archive/2011/01/06/1927702.html 1.什么是GP服务 GP服务是Geoprocessing服务的简 ...

  7. 使用Spring Profile和Mybatis进行多个数据源(H2和Mysql)的切换

    最近在做WebMagic的后台,遇到一个问题:后台用到了数据库,本来理想情况下是用Mysql,但是为了做到开箱即用,也整合了一个嵌入式 数据库H2.这里面就有个问题了,如何用一套代码,提供对Mysql ...

  8. HDU 3335 Divisibility dancing links 重复覆盖

    分析: dlx重复覆盖的巧用,重复覆盖的原理恰好符合本题的筛选方式,即选择一个数后,该数的倍数或约数可以保证在之后的搜索中不会被选择 于是修改一下启发函数,求解最大的重复覆盖即可.   其实不一定不被 ...

  9. opencv 在工业中的应用:圆孔定位

    在工业中产品或者夹具上经常有圆形孔,我们可以利用这些孔来对产品或者夹具进行定位.我用OPENCV写了个DEMO 程序,介绍如下: (1)首先点击打开图像按钮打开一幅图像 (2)进行一些参数设置 (3) ...

  10. JDK1.5新特性(五)……Typesafe Enums

    援引 Typesafe Enums - This flexible object-oriented enumerated type facility allows you to create enum ...