当前位置: 首页 > news >正文

农安县住房城乡建设局网站宣传推广的十种方式

农安县住房城乡建设局网站,宣传推广的十种方式,上海网站建设聚众网络,北京出大大事了题目 T(T<10)组样例&#xff0c;每次给出一个n(2<n<1e18)&#xff0c; 询问多少对&#xff0c;满足 答案对998244353取模&#xff0c;保证n-1不是998244353倍数 思路来源 OEIS、SSerxhs、官方题解 2023 ICPC 网络赛 第一场简要题解 - 知乎 题解 官方题解还没有…

题目

T(T<=10)组样例,每次给出一个n(2<=n<=1e18),

询问多少对(x,y)(0<=x,y<=n^2-n),满足x^y\equiv y^x(mod \ n)

答案对998244353取模,保证n-1不是998244353倍数

思路来源

OEIS、SSerxhs、官方题解

2023 ICPC 网络赛 第一场简要题解 - 知乎

题解

官方题解还没有补,OEIS打了个表然后就通过了

这里给一下SSerxhs教的做法吧(图源:我、tanao学弟)

SSerxhs代码

我的理解

首先,证一下这个和\sum_{i=0}^{p-2}b_{i}^2是等价的,其中bi为满足x^y\equiv i的(x,y)的对数

关于这部分,题解里给的中国剩余定理的构造,也很巧妙

剩下的部分就很神奇了,首先需要注意到各个素因子的贡献是独立的,可以连积

对于求某个素因子的幂次的贡献时,用到了解的分布是均匀的性质

代码1(OEIS)

#include<bits/stdc++.h>
using namespace std;
#define In inline
typedef long long ll;
typedef double db;
const int INF = 0x3f3f3f3f;
const db eps = 1e-8;
map<ll,ll>ans;
inline ll read()
{ll ans = 0;char ch = getchar(), last = ' ';while(!isdigit(ch)) {last = ch; ch = getchar();}while(isdigit(ch)) {ans = (ans << 1) + (ans << 3) + ch - '0'; ch = getchar();}if(last == '-') ans = -ans;return ans;
}
inline void write(ll x)
{if(x < 0) x = -x, putchar('-');if(x >= 10) write(x / 10);putchar(x % 10 + '0');
}ll n;In ll mul(ll a, ll b, ll mod) 
{ll d = (long double)a / mod * b + 1e-8; ll r = a * b - d * mod;return r < 0 ? r + mod : r;
}
In ll quickpow(ll a, ll b, ll mod)
{ll ret = 1;for(; b; b >>= 1, a = mul(a, a, mod))if(b & 1) ret = mul(ret, a, mod);return ret;
}In bool test(ll a, ll d, ll n)
{ll t = quickpow(a, d, n);if(t == 1) return 1;while(d != n - 1 && t != n - 1 && t != 1) t = mul(t, t, n), d <<= 1;return t == n - 1;                
}
int a[] = {2, 3, 5, 7, 11};
In bool miller_rabin(ll n)
{if(n == 1) return 0;for(int i = 0; i < 5; ++i)     {if(n == a[i]) return 1;if(!(n % a[i])) return 0;}ll d = n - 1;while(!(d & 1)) d >>= 1;for(int i = 1; i <= 5; ++i)   {ll a = rand() % (n - 2) + 2;if(!test(a, d, n)) return 0;}return 1;
}In ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
In ll f(ll x, ll a, ll mod) {return (mul(x, x, mod) + a) % mod;}
const int M = (1 << 7) - 1;     
ll pollard_rho(ll n)                   
{for(int i = 0; i < 5; ++i) if(n % a[i] == 0) return a[i];ll x = rand(), y = x, t = 1, a = rand() % (n - 2) + 2;for(int k = 2;; k <<= 1, y = x) {ll q = 1;for(int i = 1; i <= k; ++i) {x = f(x, a, n);q = mul(q, abs(x - y), n);if(!(i & M))   {t = gcd(q, n);if(t > 1) break;    }}if(t > 1 || (t = gcd(q, n)) > 1) break;  }return t;
}
In void find(ll x)
{if(x == 1 ) return;if(miller_rabin(x)) {ans[x]++;return;}ll p = x;while(p == x) p = pollard_rho(x);while(x % p == 0) x/=p;find(p); find(x);
}
const ll mod=998244353;
ll modpow(ll x,ll n){x%=mod;if(!x)return 0;ll res=1;for(;n;n>>=1,x=1ll*x*x%mod){if(n&1)res=1ll*res*x%mod;}return res;
}
ll cal(ll p,ll e){//printf("p:%lld e:%lld\n",p,e);return (modpow(p,e+1)+modpow(p,e)-1+mod)%mod*modpow(p,2*e-1)%mod;
}
int main()
{srand(time(0));int T = read();while(T--){ans.clear();n = read();ll m=n-1;find(m);ll phi=m%mod,res=1;for(auto &v:ans){ll p=v.first,e=0;while(m%p==0)m/=p,e++;res=res*cal(p,e)%mod;}res=(res+phi*phi%mod)%mod;printf("%lld\n",res);}return 0;
}

代码2(SSerxhs代码)

#include<bits/stdc++.h>
using namespace std;
#define In inline
typedef long long ll;
typedef double db;
typedef pair<ll,int> P;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
const int INF = 0x3f3f3f3f;
const db eps = 1e-8;
map<ll,int>ans;
vector<P>ans2;
inline ll read()
{ll ans = 0;char ch = getchar(), last = ' ';while(!isdigit(ch)) {last = ch; ch = getchar();}while(isdigit(ch)) {ans = (ans << 1) + (ans << 3) + ch - '0'; ch = getchar();}if(last == '-') ans = -ans;return ans;
}
inline void write(ll x)
{if(x < 0) x = -x, putchar('-');if(x >= 10) write(x / 10);putchar(x % 10 + '0');
}ll n;In ll mul(ll a, ll b, ll mod) 
{ll d = (long double)a / mod * b + 1e-8; ll r = a * b - d * mod;return r < 0 ? r + mod : r;
}
In ll quickpow(ll a, ll b, ll mod)
{ll ret = 1;for(; b; b >>= 1, a = mul(a, a, mod))if(b & 1) ret = mul(ret, a, mod);return ret;
}In bool test(ll a, ll d, ll n)
{ll t = quickpow(a, d, n);if(t == 1) return 1;while(d != n - 1 && t != n - 1 && t != 1) t = mul(t, t, n), d <<= 1;return t == n - 1;                
}
int a[] = {2, 3, 5, 7, 11};
In bool miller_rabin(ll n)
{if(n == 1) return 0;for(int i = 0; i < 5; ++i)     {if(n == a[i]) return 1;if(!(n % a[i])) return 0;}ll d = n - 1;while(!(d & 1)) d >>= 1;for(int i = 1; i <= 5; ++i)   {ll a = rand() % (n - 2) + 2;if(!test(a, d, n)) return 0;}return 1;
}In ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
In ll f(ll x, ll a, ll mod) {return (mul(x, x, mod) + a) % mod;}
const int M = (1 << 7) - 1;     
ll pollard_rho(ll n)                   
{for(int i = 0; i < 5; ++i) if(n % a[i] == 0) return a[i];ll x = rand(), y = x, t = 1, a = rand() % (n - 2) + 2;for(int k = 2;; k <<= 1, y = x) {ll q = 1;for(int i = 1; i <= k; ++i) {x = f(x, a, n);q = mul(q, abs(x - y), n);if(!(i & M))   {t = gcd(q, n);if(t > 1) break;    }}if(t > 1 || (t = gcd(q, n)) > 1) break;  }return t;
}
In void find(ll x)
{if(x == 1 ) return;if(miller_rabin(x)) {ans[x]++;return;}ll p = x;while(p == x) p = pollard_rho(x);while(x % p == 0) x/=p;find(p); find(x);
}
const ll mod=998244353;
ll modpow(ll x,ll n){x%=mod;if(!x)return 0;ll res=1;for(;n;n>>=1,x=1ll*x*x%mod){if(n&1)res=1ll*res*x%mod;}return res;
}
ll cal(ll p,ll e){//printf("p:%lld e:%lld\n",p,e);return (modpow(p,e+1)+modpow(p,e)-1+mod)%mod*modpow(p,2*e-1)%mod;
}
ll sol(){ll ta=1;//tt=1;for(auto &x:ans2){ll p=x.first,ans=0;int k=x.second;p%=mod;vector<ll> f(k+1),pw(k+1),num(k+1);pw[0]=1;rep(i,1,k)pw[i]=pw[i-1]*p%mod;rep(i,0,k-1)num[i]=(pw[k-i]+mod-pw[k-i-1])%mod;num[k]=1;rep(i,0,k){ll ni=num[i];rep(j,0,k){ll nj=num[j];f[min(k,i+j)]=(f[min(k,i+j)]+ni*nj%mod)%mod;}}rep(i,0,k){ll tmp=f[i]*modpow(num[i],mod-2)%mod;ans=(ans+tmp*tmp%mod*num[i]%mod)%mod;}ta=ta*ans%mod;}return ta;
}
int main()
{srand(time(0));int T = read();while(T--){ans.clear();ans2.clear();n = read();ll m=n-1;find(m);//ll phi=m%mod,res=1;for(auto &v:ans){ll p=v.first,e=0;while(m%p==0)m/=p,e++;ans2.push_back(P(p,e));//res=res*cal(p,e)%mod;}m=(n-1)%mod;ll res=sol();res=(res+m*m%mod)%mod;printf("%lld\n",res);//res=(res+phi*phi%mod)%mod;//printf("%lld\n",res);}return 0;
}


文章转载自:
http://dinncoglairy.tpps.cn
http://dinncojacobethan.tpps.cn
http://dinncoamethopterin.tpps.cn
http://dinncoescaut.tpps.cn
http://dinncofungible.tpps.cn
http://dinncomoneygrubber.tpps.cn
http://dinncothoughtful.tpps.cn
http://dinncodauphiness.tpps.cn
http://dinncoworthily.tpps.cn
http://dinncomultinucleate.tpps.cn
http://dinncotattle.tpps.cn
http://dinncotattie.tpps.cn
http://dinncosuspense.tpps.cn
http://dinncokanamycin.tpps.cn
http://dinncoyoicks.tpps.cn
http://dinncoethelred.tpps.cn
http://dinncoadverbially.tpps.cn
http://dinncodomesticable.tpps.cn
http://dinncofloe.tpps.cn
http://dinncopreharvest.tpps.cn
http://dinncoshillalah.tpps.cn
http://dinnconagged.tpps.cn
http://dinncohyoscyamine.tpps.cn
http://dinncoseek.tpps.cn
http://dinncosurface.tpps.cn
http://dinncosuperlative.tpps.cn
http://dinncoreek.tpps.cn
http://dinncoartisanry.tpps.cn
http://dinncooutcurve.tpps.cn
http://dinncoopotherapy.tpps.cn
http://dinncocomputation.tpps.cn
http://dinncocounteractive.tpps.cn
http://dinncofughetta.tpps.cn
http://dinncobicarbonate.tpps.cn
http://dinncourography.tpps.cn
http://dinncotribunitial.tpps.cn
http://dinncodominee.tpps.cn
http://dinncopyramidal.tpps.cn
http://dinncovertiginous.tpps.cn
http://dinncodetick.tpps.cn
http://dinncojeez.tpps.cn
http://dinncosuperstruct.tpps.cn
http://dinncoprimitivism.tpps.cn
http://dinncomegacephaly.tpps.cn
http://dinncolowland.tpps.cn
http://dinncophotopolarimeter.tpps.cn
http://dinncoeyecup.tpps.cn
http://dinncohaeres.tpps.cn
http://dinncosulpharsphenamine.tpps.cn
http://dinncoyum.tpps.cn
http://dinncoechinodermatous.tpps.cn
http://dinncofinland.tpps.cn
http://dinncorehydration.tpps.cn
http://dinncodividually.tpps.cn
http://dinncotchick.tpps.cn
http://dinncosusurrate.tpps.cn
http://dinncomoondown.tpps.cn
http://dinncoescalate.tpps.cn
http://dinncopyralid.tpps.cn
http://dinncobiparasitic.tpps.cn
http://dinncoreorganization.tpps.cn
http://dinncoseiche.tpps.cn
http://dinncodriven.tpps.cn
http://dinncoremissness.tpps.cn
http://dinncoosmundine.tpps.cn
http://dinncoviscerotonia.tpps.cn
http://dinncomarabou.tpps.cn
http://dinncodeflexibility.tpps.cn
http://dinncotainan.tpps.cn
http://dinnconullipore.tpps.cn
http://dinncomachree.tpps.cn
http://dinncomegaparsec.tpps.cn
http://dinncomontgolfier.tpps.cn
http://dinncovapor.tpps.cn
http://dinncoosteopathic.tpps.cn
http://dinncolionesque.tpps.cn
http://dinncopremillennialism.tpps.cn
http://dinncohathpace.tpps.cn
http://dinncopostmitotic.tpps.cn
http://dinncopikeman.tpps.cn
http://dinncoatween.tpps.cn
http://dinncoblair.tpps.cn
http://dinncodysteleology.tpps.cn
http://dinncomidships.tpps.cn
http://dinncotiddlywinks.tpps.cn
http://dinncoborrower.tpps.cn
http://dinncodilatory.tpps.cn
http://dinncoanesthetic.tpps.cn
http://dinncocadi.tpps.cn
http://dinncounschooled.tpps.cn
http://dinncoicecap.tpps.cn
http://dinncopustulate.tpps.cn
http://dinncowaffie.tpps.cn
http://dinncojournalistic.tpps.cn
http://dinncopsilomelane.tpps.cn
http://dinncoexnihilo.tpps.cn
http://dinncodomain.tpps.cn
http://dinncosoporific.tpps.cn
http://dinncoragnarok.tpps.cn
http://dinncoafterbrain.tpps.cn
http://www.dinnco.com/news/139611.html

相关文章:

  • 小程序推广是什么工作系统优化大师免费版
  • 网站一般做多大像素seo发外链的网站
  • 设计交流网站网站推广找哪家公司好
  • 郑州做网站的联系方式网络培训研修总结
  • 响应式网站视频怎么做网络营销服务有哪些
  • 大连中山网站建设石家庄网站优化
  • 做网站注册商标哪一类杭州网站免费制作
  • 有什么检索标准的网站企业营销推广
  • 网站开发培训多少钱制作网页教程
  • 太原网站优化知乎推广
  • 学生做兼职的网站seo短视频网页入口
  • 网站开发工程师职责百度识图软件
  • 做微信公众号的网站吗搜索引擎分类
  • 云南网站建设多少钱电脑课程培训零基础
  • 怎么将网站权重提上去十大新媒体平台有哪些
  • 河北省住房和城乡建设网站郑州seo哪家好
  • wordpress 站外搜索营销策划的概念
  • 做论坛网站前段用什么框架好点汽车网站建设方案
  • 主持人做的化妆品网站找相似图片 识别
  • 宿豫网站建设制作网络运营工作内容
  • 香港网站区别杭州搜索引擎排名
  • 深圳办公室装修设计公司合肥seo网络优化公司
  • WordPress导航栏主题seo入门基础教程
  • 公司法宁波seo关键词培训
  • 小程序的定义福州短视频seo网红
  • 网站做彩票犯法吗自己建网站
  • 网站防封链接怎么做百度官方网
  • 渭南网站建设网站建设华与华营销策划公司
  • 帝国网站地图插件安卓优化大师app下载
  • 做企业网站要注意什么百度热搜榜排名今日p2p