577A - Multiplication Table - CodeForces Solution


implementation number theory *1000

Please click on ads to support us..

Python Code:

l=list(map(int,input().split()))
n=l[0]
k=l[1]
count=0
for i in range(1,n+1):
    if (i<=k and k%i==0 and k/i<=n):
        count+=1
print(count)

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i, n) for (ll i = 0; i < n; i++)
#define forn(i, n) for (ll i = 1; i < n; i++)
#define forne(i, n) for (ll i = 1; i <= n; i++)
#define revn(i, n) for (ll i = n - 1; i >= 0; i--)
#define sortl(v) sort(v.begin(), v.end())
#define reversal(v) reverse(v.begin(), v.end())
#define countset(n) __builtin_popcountll(n)
#define maxelement(v) *max_element(v.begin(), v.end())
#define minelement(v) *min_element(v.begin(), v.end())
#define vi vector<ll>
#define f(map) for (auto it : map)
#define read(n) \
    ll n;       \
    cin >> n;
const int inf = 1e9 + 7;
const int maxn = 1e6;
const int M = 1e9 + 7;
vector<ll> fact(1e6);
vector<ll> inversion(1e6);
vector<bool> seive(maxn, true);
void sieveness()
{
    seive[0] = seive[1] = false;

    for (ll i = 2; i * i <= maxn; i++)
    {
        if (seive[i] == true)
            for (ll j = i * i; j <= maxn; j += i)
            {
                seive[j] = false;
            }
    }
}
bool isprime(long long n)
{
    // check whether a number is prime or not
    for (long long i = 2; i * i <= n; i++)
        if (n % i == 0)
            return false;
    return true;
}
long long binpow(long long a, long long b, long long m)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
void initialization()
{
    fact[0] = 1;
    fact[1] = 1;
    for (ll i = 2; i <= 3000000; i++)
    {
        fact[i] = (fact[i - 1] * i) % M;
    }
    inversion[3000000] = binpow(fact[3000000], M - 2, M) % M;
    for (ll i = 3000000; i > 0; i--)
    {
        inversion[i - 1] = (inversion[i] * i) % M;
    }
}
ll C(ll n, ll k)
{
    ll res = (((fact[n] * inversion[k]) % M) * inversion[n - k]) % M;
    return res;
}
vector<ll> factorization(ll n)
{
    vector<ll> res;
    for (ll i = 1; i * i <= n; i++)
    {
        if ((n % i) == 0)
        {
            ll a = n / i;
            if (i == a)
            {
                res.push_back(i);
            }
            else
            {
                res.push_back(i);
                res.push_back(n / i);
            }
        }
    }
    return res;
}
ll andOperator(ll l, ll r)
{
    ll rtn = 0;
    for (ll i = 0; i <= 63; i++)
    {
        if (!(l & (1ll << i)))
            continue;
        if (!(r & (1ll << i)))
            continue;
        if ((l >> i) != (r >> i))
            continue;
        rtn += (1ll << i);
    }
    return rtn;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll test = 1;
    // cin >> test;
    while (test--)
    {
        ll i, j, a, b, c, d, v1, v2, f, cnt, ans, res, print;
        read(n);
        read(x);
        cnt = 0;
        forne(i, n)
        {
            ll x1 = x / i;
            if (x1 <= n && x % i == 0)
                cnt++;
        }
        cout << cnt << endl;
    }

    return 0;
}


Comments

Submit
0 Comments
More Questions

1711B - Party
1702D - Not a Cheap String
1714F - Build a Tree and That Is It
1703F - Yet Another Problem About Pairs Satisfying an Inequality
610A - Pasha and Stick
1200A - Hotelier
1091A - New Year and the Christmas Ornament
1352B - Same Parity Summands
1102A - Integer Sequence Dividing
630B - Moore's Law
1004A - Sonya and Hotels
1680B - Robots
1690A - Print a Pedestal (Codeforces logo)
1295A - Display The Number
1077A - Frog Jumping
1714G - Path Prefixes
1369C - RationalLee
289B - Polo the Penguin and Matrix
1716A - 2-3 Moves
1670B - Dorms War
1716B - Permutation Chain
987A - Infinity Gauntlet
1676G - White-Black Balanced Subtrees
1716D - Chip Move
1352F - Binary String Reconstruction
1487B - Cat Cycle
1679C - Rooks Defenders
56A - Bar
1694B - Paranoid String
35A - Shell Game