Codeforces 577 - A problem solution

A. Multiplication Table
time limit per test 1 second
memory limit per test 256 megabytes
input standard input
output standard output

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 ≤ 1051 ≤ 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.                                                             

Problem link : https://codeforces.com/problemset/problem/577/A

Solution :

  • [tab]
    • C++
      • #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            int n,x,i,ans=0;
            cin>>n>>x;
            for(i=1;i<=n;i++)
            {
                if(x%i==0 && x/i<=n)
                {
                    ans++;
                }
            }
            cout<<ans<<endl;
            return 0;
        }
        
3/Technology/post-list
Name

Codeforces,53,Problem Solve,90,Programming Tricks,1,URI,37,
ltr
item
DorHubs: Codeforces 577 - A problem solution
Codeforces 577 - A problem solution
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKNGL9DQ6pXFg6PH63q2Z508Nv9QikSIi38jXAHgRYfOjkP-Ct6ONxnOBlSBh_JNSGpTGiBbNSVm7GkZsf9O8c19oWU26WFoMM-FINQfCjYRgL0wi3yZOl34t1YJXMwsYe2WyLtUq5Hw6z/s1600/a97618c55d045568a1dccb1e2cfd2bbb908f0d08.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKNGL9DQ6pXFg6PH63q2Z508Nv9QikSIi38jXAHgRYfOjkP-Ct6ONxnOBlSBh_JNSGpTGiBbNSVm7GkZsf9O8c19oWU26WFoMM-FINQfCjYRgL0wi3yZOl34t1YJXMwsYe2WyLtUq5Hw6z/s72-c/a97618c55d045568a1dccb1e2cfd2bbb908f0d08.png
DorHubs
https://dorhubs.blogspot.com/2019/07/codeforces-577-problem-solution_19.html
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/2019/07/codeforces-577-problem-solution_19.html
true
9087637800571592252
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy