CodeForces - 577A Multiplication Table(물)

1767 단어
CodeForces - 577A
Multiplication Table
Time Limit: 1000MS
 
Memory Limit: 262144KB
 
64bit IO Format: %I64d & %I64u
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
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
",cnt); } return 0; }

좋은 웹페이지 즐겨찾기