当前位置:网站首页>逆元(名字太多人用我就加这几个字)
逆元(名字太多人用我就加这几个字)
2022-07-17 00:15:00 【HYYyyying】
生活不易,我先叹气!
诶,之前没懂逆元。
“啊这题我咋wa了呜呜”
xx:“因为你没会逆元”
记录一下写题过程…
51nod题目链接传送门
一:
逆元:
还是别人写的好,妙啊哈哈哈,别人家的好博客
费马小定理:
费马小定理百度百科

题意如上
诶,我好菜
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
ll n;
ll qpow(ll x, ll y){
ll res = 1;
while(y){
if(y & 1){
res = res * x % mod;
}
y >>= 1;
x = x * x % mod;
}
return res % mod;
}
int main(){
cin >> n;
ll ans = 0;
ans = (qpow(3, n + 1) - 1) % mod;
ans *= qpow(2, mod - 2) % mod;
ans %= mod;
cout << ans << endl;
return 0;
}
热血沸腾的去写了几题逆元的,5555555TLE了
震惊发现,我是傻逼 求逆元有几种方式,咳咳
边栏推荐
猜你喜欢

逻辑漏洞----身份验证漏洞

Chapter 2 - system control principle - > classical control theory

STL--deque容器

Bugku---- regular matching, cookies

【HDRP高清渲染管道】创建HDRP工程,把内置管线工程升级为HDRP工程

(with word operation and video explanation) map registration using ArcGIS_ Projection transformation_ General map making_ Thematic map making

Summary of tree and heap knowledge points

【Unity面板属性扫盲】导入纹理后设置Texture Import Settings

Logical vulnerability - authentication vulnerability

初识阿里云环境搭建:无法远程连接,入过的坑:服务器ping不通,FTP搭建,服务器搭建数据库,远程连接服务器数据库
随机推荐
【工具篇】Unity2D人物控制器,控制2D玩家移动跳跃,四方向和水平方向
Attack and defense world - easytornado notes
第二讲 BTC-密码学原理(笔记)
flask模板注入
Attack and defense the world ---- shrink
Clion installation and ROS development to realize automatic prompt completion
【Unity编辑器扩展】Unity资产预处理和后处理图片自动转Sprite2D
UE4 笔记
Leetcode 1: Two Sum
ENVI_ IDL: read OMI data (HDF5) and output it as GeoTIFF file + detailed parsing
STL -- stack container
Array Transformer-分块思想
LeetCode:动态规划中的子序列问题
ENVI:(2022年最详细的教程)自定义坐标系
Gdb+vscode for debugging 1 -- compile and debug using cmakelist files + attach process debugging
动态规划 - 01背包问题
二叉树的遍历
STL -- List container (linked list)
[unity panel attribute literacy] set texture import settings after importing textures
ENVI_ Idl: batch Reproject MODIS swath products and specify the range output as GeoTIFF format + parsing