Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- weak weak we ak we akwea weak we
- weak weak we ak weak weak we ak we
- weakweak we ak wea ak we akwe
- wea we ak we ak we akwe
- wea we ak we ak we akwe
- wea eak weak we ak we ak we
- wea wea ak we ak weak we
- we
- we ak wea ak weak we
- we ak wea weak wea eak we
- we ak we ak wea wea we we
- weak we ak we we we we
- we we ak we we we we
- we wea weak wea wea weak weak
- weak wea akw weak weak
- */
- //#define _GLIBCXX_DEBUG //is only used when couldn't find bug
- using namespace std;
- #pragma GCC optimize ("Ofast")
- /*
- Never gonna give you up
- Never gonna let you down
- Never gonna run around and desert you
- Never gonna make you cry
- Never gonna say goodbye
- Never gonna tell a lie and hurt you
- */
- //headers
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <cmath>
- #include <utility>
- #include <bitset>
- #include <set>
- #include <string>
- #include <stack>
- #include <iomanip>
- #include <map>
- #include <memory.h>
- #include <deque>
- #include <time.h>
- #include <assert.h>
- #include <unordered_map>
- #include <unordered_set>
- #include <sstream>
- #include <random>
- //defines
- typedef long long ll;
- typedef pair<int,int> pii;
- typedef pair<ll, ll> pll;
- typedef vector<int> vi;
- typedef vector<ll> vl;
- typedef vector<vector<int>> vvi;
- typedef vector<vector<ll>> vvl;
- #define pb push_back
- #define F first
- #define S second
- #define mid (LB+RB)/2
- #define mkp make_pair
- //iterators
- #define iter(x) x.begin(),x.end()
- #define aiter(a,n) a,a+n
- //loops
- #define REP(n) for (int ___=n > 0 ? n : 0;___--;)
- #define REP0(i,n) for (int i=0,___=n;i<___;++i)
- #define REP1(i,n) for (int i=1,___=n;i<=___;++i)
- #define MEM(e,val) memset (e,val,sizeof(e))
- /*
- When he said Super Idol的笑容 都没你的甜 八月正午的阳光 都没你耀眼 热爱105℃的你 滴滴清纯的蒸馏水 你不知道你有多可爱 跌倒后会傻笑着再站起来 你从来都不轻言失败 对梦想的执着一直不曾更改 很安心 当你对我说 不怕有我在 放着让我来 勇敢追自己的梦想 那坚定的模样 Super Idol的笑容 都没你的甜 八月正午的阳光 都没你耀眼 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 不怕失败来一场 痛快的热爱 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 莫忘了初心常在 痛快去热爱 爱105℃的你 滴滴清纯的蒸馏水 喝一口又活力全开 再次回到最佳状态 喝一口哟 你不知道你有多可爱 跌倒后会傻笑着再站起来 你从来都不轻言失败 对梦想的执着一直不曾更改 很安心 当你对我说 不怕有我在 放着让我来 勇敢追自己的梦想 那坚定的模样 Super Idol的笑容 都没你的甜 八月正午的阳光 都没你耀眼 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 不怕失败来一场 痛快的热爱 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 莫忘了初心常在 痛快去热爱 热爱105℃的你 滴滴清纯的蒸馏水 喝一口又活力全开 再次回到最佳状态 喝一口又活力全开
- I really felt that.
- every one is so dian except me
- still too weak 咩噗
- */
- //IO
- #include <cstdio>
- #include <iostream>
- #include <fstream>
- #define want_to_be_more_dian ios_base::sync_with_stdio(false),cin.tie(0);
- //pbds
- /*
- #include <ext/pb_ds/tree_policy.hpp>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/priority_queue.hpp>
- using namespace __gnu_pbds;
- //tree <pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>;
- */
- //constants
- #include <climits>
- const int maxn = 1e5,mod = 998244353;
- const long long inf = 0;
- const double eps = 0;
- //workspace
- inline void solve(){
- ll x, l, r;
- cin >> x >> l >> r;
- ll ans = 0;
- for (ll i=1,__=sqrt(sqrt(x));i<=__;++i){
- for (ll j=i+1;i*j*(j+1)*(j+2)<=x;++j){
- ll ij = i*j;
- // find maxc(k)
- __int128_t lb = j, rb = x / ij;
- while (lb < rb){
- __int128_t m = (lb + rb + 1) / 2;
- if (i * j * m * (m+1) <= x) lb = m;
- else rb = m-1;
- }
- if (lb == j) break;
- ll maxc = lb;
- // if (i * j * maxc > INT_MAX) cerr << i << ' ' << j << ' ' << maxc << '\n';
- // ij as cd
- if (l <= i+j && i+j < r){
- ans = (ans + maxc - j) % mod;
- }
- // ik as cd
- // find upper bound of k
- if (min(maxc, r - i - 1) > max((ll)j, l-i-1)) ans = (ans + min(maxc, r - i - 1) - max((ll)j, l-i-1)) % mod;
- // jk as cd
- // find upper bound of k
- if (min(maxc, r - j - 1) > max((ll)j, l-j-1)) ans = (ans + min(maxc, r - j - 1) - max((ll)j, l-j-1)) % mod;
- // il as cd
- // find upper bound of k
- lb = j; rb = maxc;
- while (lb < rb){
- __int128_t m = (lb + rb + 1) / 2;
- if (i + x / (i * j * m) >= l) lb = m;
- else rb = m-1;
- }
- ll ub = lb;
- // find lower bound of k
- lb = j+1; rb = maxc+1;
- while (lb < rb){
- __int128_t m = (lb + rb) / 2;
- if (i + x / (i * j * m) < r) rb = m;
- else lb = m+1;
- }
- if (lb <= ub) ans = (ans - lb + ub + 1) % mod;
- // jl as cd
- // find upper bound of k
- lb = j; rb = maxc;
- while (lb < rb){
- __int128_t m = (lb + rb + 1) / 2;
- if (j + x / (i * j * m) >= l) lb = m;
- else rb = m-1;
- }
- ub = lb;
- // find lower bound of k
- lb = j+1; rb = maxc+1;
- while (lb < rb){
- __int128_t m = (lb + rb) / 2;
- if (j + x / (i * j * m) < r) rb = m;
- else lb = m+1;
- }
- if (lb <= ub) ans = (ans - lb + ub + 1) % mod;
- // kl as cd
- // find upper bound of k
- lb = j; rb = maxc;
- while (lb < rb){
- __int128_t m = (lb + rb + 1) / 2;
- if (m + x / (i * j * m) >= l) lb = m;
- else rb = m-1;
- }
- //cout << i << ' ' << j << ' ' << lb << ' ' << rb << '\n';
- ub = lb;
- // find lower bound of k
- lb = j+1; rb = maxc+1;
- while (lb < rb){
- __int128_t m = (lb + rb) / 2;
- if (m + x / (i * j * m) < r) rb = m;
- else lb = m+1;
- }
- //cout << i << ' ' << j << ' ' << lb << ' ' << rb << '\n';
- if (lb <= ub) ans = (ans - lb + ub + 1) % mod;
- }
- }
- cout << ans * 4 % mod;
- }
- signed main(){
- want_to_be_more_dian
- //int t,i=1; for (int ;cin;)//use in multi-testcases and end in EOF problems
- //int t,i=1; for (cin >> t;i<=t;++i)//use in multi-testcases problems
- //cout << "Case #" << i << ": ",//use in Google, FB competitions
- solve();//always used
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement