Ni Yuan(これらの単語を追加するために私を使用する人が多すぎます)

人生は簡単ではありません、最初にため息をつきましょう!
ねえ、私は前にニユアンを理解していませんでした。
「ああ、私はこの質問で何をした」
XX:「あなたは知らなかったので
質問書き方をXXを:「あなたは知っていないので、質問を作成する方法...
51nodのトピックリンクポータル
1:Nigenを
:それは
よりよい他の誰か、素晴らしいハハハ、によって書かれている他の人の家良いブログ
Fermatの小さな定理:
Fermatの小さな定理

タイトル説明
タイトルの意味は上記の通り
ここに写真の説明を挿入
です。

#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
私はばかとわかってショックを受けました逆要素を見つけるにはいくつかの方法があります、咳

おすすめ

転載: blog.csdn.net/qq_45759072/article/details/108894577