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相关推荐
- 证明与计算(2): 离散对数问题(Discrete logarithm Problem, DLP)
本文链接,随时更新请不要转载以免过期:证明与计算(2): 离散对数问题(Discrete logarithm Problem, DLP) - ffl - 博客园 离散对数问题,英文是Discrete ...
- Practical Zero-Knowledge Protocols Based on the Discrete Logarithm Assumption 学习笔记 1
1. 引言 Stephanie Bayer 2013年博士论文 <Practical Zero-Knowledge Protocols Based on the Discrete Logarit ...
- 数学 ( 解高次同余方程 )——Discrete Logarithm Problem ( UVA 7457 )
题目链接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show ...
- 【CF gym 103260】40th Petrozavodsk Programming Camp, Day 5,2021.2.3 水题2题
M.Discrete Logarithm is a Joke 题意: 思路: 不难想到an=g^{an+1},因为样例给了 a[1000000]的值,所以反着推就行了. 记得开int128,longl ...
- Elliptic Curve Cryptography: finite fields and discrete logarithms
转载自:https://andrea.corbellini.name/2015/05/23/elliptic-curve-cryptography-finite-fields-and-discrete ...
- Proof Systems for General Statements about Discrete Logarithms 学习笔记
Jan Camenisch和Markus Stadler 1997年论文<Proof Systems for General Statements about Discrete Logarith ...
- qesa Efficient zero-knowledge arguments in the discrete log setting 学习笔记
1. 引言 Hoffmann等人 2019年论文 <Efficient zero-knowledge arguments in the discrete log setting >. 相应 ...
- SNARK性能及安全——Prover篇
1. 引言 SNARK (Succinct Non-interactive Arguments of Knowledge) 是实现: 1)区块链扩容(如L2 rollups) 2)隐私 的重要密码学原 ...
- bnu10805矩形神码的
矩形神码的 Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld Java class name: ...
最新文章
- 基于VC++的GDI常用坐标系统及应用
- MM模块几个移动类型之间的区别
- jQuery浏览器版本判断
- 构建iscsi网络存储服务
- zigbee协议栈的系统相关函数的使用 仿照协议栈写事件
- java 重启线程_java-如何重新启动线程
- 白话讲解:消息队列到底解决了什么问题?
- Unity C#代码小技巧
- python音乐推荐系统_音乐推荐系统
- 维修电工技师技能实训考核装置QY-W05
- 光伏并网系统的谐波分析
- java html模板转图片、动态绑定数据
- 电商产品精修训练营第3天_ps抠图
- 群晖Video Staiton套件 安卓TV端使用教程
- 【深度学习模型】了解一下Faster RCNN
- 2020电子信息夏令营(湖大,吉大,中山,武大,浙大)
- 我们怎样才能过好这一生?
- OSChina 周二乱弹 —— 好支威有希
- Android指南针陀螺仪开发
- h5压缩图片 亲测有效
热门文章
- 反复下蹲,你的膝盖响几下?
- SAP Business One和SAP All-in-One
- 判断当前一个物料被其他人锁定
- excel宏病毒专杀方法
- 再向“乡镇青年”下沉,“资讯界拼多多”趣头条也难成为另一个拼多多
- 计算机辅助普通话水平测试评分办法,江苏省计算机辅助普通话水平测试评分细则...
- visual studio 调试时提示 已加载“C:\Windows\SysWOW64\ntdll.dll”。无法查找或打开 PDB 文件。
- java 随机数 分布_java – 随机数的分布
- python 结束子线程并保证工作完成_python3中在线程中结束工作进程的方法
- 计算机组装与维护致谢,毕业设计(论文)_计算机组装与维护 .doc