日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Discrete Logarithm is a Joke __int128 浮点数e

發布時間:2025/3/19 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Discrete Logarithm is a Joke __int128 浮点数e 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


思路 :

  • 這段代碼只能C++ 17的64位版本或者20的64位版本,否則會CE
  • ai=gai+1a_i = g^{a_{i+1}}ai?=gai+1?,且樣例給了上界的答案,所以倒推
  • long long會爆,所以要用__int128
  • __int128的輸入輸出方式
  • long long x = 1e18 + 31 cout x會得到1000(省略0),也就是說爆了,
  • double x = 1e18 + 31 cout x會得到1e+18,printf x會得到1000000000000000000.000000
#include <iostream>using namespace std;typedef __int128 ll;const int N = 1e6 + 10;//const ll mod = 1e18 + 31; wa!!不要用浮點數表示整數 const ll mod = 1000000000000000031;ll f[N];ll qmi(ll a, ll b, ll q) {ll res = 1 % q;while (b){if (b & 1) res = res * a % q;a = a * (ll)a % q;b >>= 1;}return res; }inline __int128 read() {__int128 x = 0, f = 1;char ch = getchar();while (ch < '0' || ch > '9'){if (ch == '-') f = -1;ch = getchar();}while (ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}return x * f; }inline void print(__int128 x) {if (x < 0){putchar('-');x = -x;}if (x > 9)print(x / 10);putchar(x % 10 + '0'); }int main() {int n = 1e6;f[n] = 300;for (int i = n - 1; i >= 0; i -- )f[i] = qmi(42ll, f[i + 1], mod);int x;cin >> x;print(f[x]);return 0; }

總結

以上是生活随笔為你收集整理的Discrete Logarithm is a Joke __int128 浮点数e的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。