Advertisement
yungyao

Untitled

Sep 4th, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 KB | None | 0 0
  1. /*
  2.  
  3.  
  4. weak weak we ak we akwea weak we
  5. weak weak we ak weak weak we ak we
  6. weakweak we ak wea ak we akwe
  7. wea we ak we ak we akwe
  8. wea we ak we ak we akwe
  9. wea eak weak we ak we ak we
  10. wea wea ak we ak weak we
  11. we
  12. we ak wea ak weak we
  13. we ak wea weak wea eak we
  14. we ak we ak wea wea we we
  15. weak we ak we we we we
  16. we we ak we we we we
  17. we wea weak wea wea weak weak
  18. weak wea akw weak weak
  19.  
  20.  
  21. */
  22. //#define _GLIBCXX_DEBUG //is only used when couldn't find bug
  23. using namespace std;
  24. #pragma GCC optimize ("Ofast")
  25. /*
  26. Never gonna give you up
  27. Never gonna let you down
  28. Never gonna run around and desert you
  29. Never gonna make you cry
  30. Never gonna say goodbye
  31. Never gonna tell a lie and hurt you
  32. */
  33. //headers
  34. #include <vector>
  35. #include <queue>
  36. #include <algorithm>
  37. #include <cmath>
  38. #include <utility>
  39. #include <bitset>
  40. #include <set>
  41. #include <string>
  42. #include <stack>
  43. #include <iomanip>
  44. #include <map>
  45. #include <memory.h>
  46. #include <deque>
  47. #include <time.h>
  48. #include <assert.h>
  49. #include <unordered_map>
  50. #include <unordered_set>
  51. #include <sstream>
  52. #include <random>
  53.  
  54. //defines
  55. typedef long long ll;
  56. typedef pair<int,int> pii;
  57. typedef pair<ll, ll> pll;
  58. typedef vector<int> vi;
  59. typedef vector<ll> vl;
  60. typedef vector<vector<int>> vvi;
  61. typedef vector<vector<ll>> vvl;
  62. #define pb push_back
  63. #define F first
  64. #define S second
  65. #define mid (LB+RB)/2
  66. #define mkp make_pair
  67.  
  68. //iterators
  69. #define iter(x) x.begin(),x.end()
  70. #define aiter(a,n) a,a+n
  71.  
  72. //loops
  73. #define REP(n) for (int ___=n > 0 ? n : 0;___--;)
  74. #define REP0(i,n) for (int i=0,___=n;i<___;++i)
  75. #define REP1(i,n) for (int i=1,___=n;i<=___;++i)
  76. #define MEM(e,val) memset (e,val,sizeof(e))
  77.  
  78. /*
  79. When he said Super Idol的笑容 都没你的甜 八月正午的阳光 都没你耀眼 热爱105℃的你 滴滴清纯的蒸馏水 你不知道你有多可爱 跌倒后会傻笑着再站起来 你从来都不轻言失败 对梦想的执着一直不曾更改 很安心 当你对我说 不怕有我在 放着让我来 勇敢追自己的梦想 那坚定的模样 Super Idol的笑容 都没你的甜 八月正午的阳光 都没你耀眼 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 不怕失败来一场 痛快的热爱 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 莫忘了初心常在 痛快去热爱 爱105℃的你 滴滴清纯的蒸馏水 喝一口又活力全开 再次回到最佳状态 喝一口哟 你不知道你有多可爱 跌倒后会傻笑着再站起来 你从来都不轻言失败 对梦想的执着一直不曾更改 很安心 当你对我说 不怕有我在 放着让我来 勇敢追自己的梦想 那坚定的模样 Super Idol的笑容 都没你的甜 八月正午的阳光 都没你耀眼 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 不怕失败来一场 痛快的热爱 热爱105℃的你 滴滴清纯的蒸馏水 在这独一无二 属于我的时代 莫忘了初心常在 痛快去热爱 热爱105℃的你 滴滴清纯的蒸馏水 喝一口又活力全开 再次回到最佳状态 喝一口又活力全开
  80. I really felt that.
  81.  
  82.  
  83. every one is so dian except me
  84. still too weak 咩噗
  85. */
  86.  
  87. //IO
  88. #include <cstdio>
  89. #include <iostream>
  90. #include <fstream>
  91. #define want_to_be_more_dian ios_base::sync_with_stdio(false),cin.tie(0);
  92.  
  93. //pbds
  94. /*
  95. #include <ext/pb_ds/tree_policy.hpp>
  96. #include <ext/pb_ds/assoc_container.hpp>
  97. #include <ext/pb_ds/priority_queue.hpp>
  98. using namespace __gnu_pbds;
  99. //tree <pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>;
  100. */
  101.  
  102. //constants
  103. #include <climits>
  104. const int maxn = 1e5,mod = 998244353;
  105. const long long inf = 0;
  106. const double eps = 0;
  107.  
  108. //workspace
  109.  
  110. inline void solve(){
  111. ll x, l, r;
  112.  
  113. cin >> x >> l >> r;
  114. ll ans = 0;
  115. for (ll i=1,__=sqrt(sqrt(x));i<=__;++i){
  116. for (ll j=i+1;i*j*(j+1)*(j+2)<=x;++j){
  117. ll ij = i*j;
  118. // find maxc(k)
  119. __int128_t lb = j, rb = x / ij;
  120. while (lb < rb){
  121. __int128_t m = (lb + rb + 1) / 2;
  122. if (i * j * m * (m+1) <= x) lb = m;
  123. else rb = m-1;
  124. }
  125. if (lb == j) break;
  126. ll maxc = lb;
  127. // if (i * j * maxc > INT_MAX) cerr << i << ' ' << j << ' ' << maxc << '\n';
  128.  
  129. // ij as cd
  130. if (l <= i+j && i+j < r){
  131. ans = (ans + maxc - j) % mod;
  132. }
  133. // ik as cd
  134. // find upper bound of k
  135. 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;
  136.  
  137. // jk as cd
  138. // find upper bound of k
  139. 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;
  140.  
  141. // il as cd
  142. // find upper bound of k
  143. lb = j; rb = maxc;
  144. while (lb < rb){
  145. __int128_t m = (lb + rb + 1) / 2;
  146. if (i + x / (i * j * m) >= l) lb = m;
  147. else rb = m-1;
  148. }
  149. ll ub = lb;
  150. // find lower bound of k
  151. lb = j+1; rb = maxc+1;
  152. while (lb < rb){
  153. __int128_t m = (lb + rb) / 2;
  154. if (i + x / (i * j * m) < r) rb = m;
  155. else lb = m+1;
  156. }
  157. if (lb <= ub) ans = (ans - lb + ub + 1) % mod;
  158.  
  159. // jl as cd
  160. // find upper bound of k
  161. lb = j; rb = maxc;
  162. while (lb < rb){
  163. __int128_t m = (lb + rb + 1) / 2;
  164. if (j + x / (i * j * m) >= l) lb = m;
  165. else rb = m-1;
  166. }
  167. ub = lb;
  168. // find lower bound of k
  169. lb = j+1; rb = maxc+1;
  170. while (lb < rb){
  171. __int128_t m = (lb + rb) / 2;
  172. if (j + x / (i * j * m) < r) rb = m;
  173. else lb = m+1;
  174. }
  175. if (lb <= ub) ans = (ans - lb + ub + 1) % mod;
  176.  
  177. // kl as cd
  178. // find upper bound of k
  179. lb = j; rb = maxc;
  180. while (lb < rb){
  181. __int128_t m = (lb + rb + 1) / 2;
  182. if (m + x / (i * j * m) >= l) lb = m;
  183. else rb = m-1;
  184. }
  185. //cout << i << ' ' << j << ' ' << lb << ' ' << rb << '\n';
  186. ub = lb;
  187. // find lower bound of k
  188. lb = j+1; rb = maxc+1;
  189. while (lb < rb){
  190. __int128_t m = (lb + rb) / 2;
  191. if (m + x / (i * j * m) < r) rb = m;
  192. else lb = m+1;
  193. }
  194. //cout << i << ' ' << j << ' ' << lb << ' ' << rb << '\n';
  195. if (lb <= ub) ans = (ans - lb + ub + 1) % mod;
  196. }
  197. }
  198.  
  199. cout << ans * 4 % mod;
  200. }
  201.  
  202. signed main(){
  203. want_to_be_more_dian
  204. //int t,i=1; for (int ;cin;)//use in multi-testcases and end in EOF problems
  205. //int t,i=1; for (cin >> t;i<=t;++i)//use in multi-testcases problems
  206. //cout << "Case #" << i << ": ",//use in Google, FB competitions
  207. solve();//always used
  208. return 0;
  209. }
  210.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement