优化网站标题百度seo搜索排名
news/
2025/10/4 5:30:11/
文章来源:
优化网站标题,百度seo搜索排名,我的世界做指令的网站,网站后台 生成所有页面传送门 文章目录题意#xff1a;思路#xff1a;题意#xff1a;
给你d,modd,modd,mod#xff0c;让你求能构造出如下序列aaa的个数模modmodmod#xff1a;
思路#xff1a;
首先可以发现aaa的长度不能超过log2dlog_2dlog2d#xff0c;因为如果存在两个aaa的二进制…传送门
文章目录题意思路题意
给你d,modd,modd,mod让你求能构造出如下序列aaa的个数模modmodmod
思路
首先可以发现aaa的长度不能超过log2dlog_2dlog2d因为如果存在两个aaa的二进制位数相同的话那么最高位异或之后一定会变成0那么bbb一定小于之前的某个bbb所以我们就看每个二进制位选或者不选来组合出来答案即可比如当前二进制位是iii那么他的方案就是(1(i1))−(1i)1(1(i1))-(1i)1(1(i1))−(1i)1要注意到最后一位二进制的时候需要特判一下n−(1i)2n-(1i)2n−(1i)2累乘起来就好辣。
// Problem: D. Dreamoon Likes Sequences
// Contest: Codeforces - Codeforces Round #631 (Div. 2) - Thanks, Denis aramis Shitov!
// URL: https://codeforces.com/contest/1330/problem/D
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)//#pragma GCC optimize(Ofast,no-stack-protector,unroll-loops,fast-math)
//#pragma GCC target(sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tunenative)
//#pragma GCC optimize(2)
#includecstdio
#includeiostream
#includestring
#includecstring
#includemap
#includecmath
#includecctype
#includevector
#includeset
#includequeue
#includealgorithm
#includesstream
#includectime
#includecstdlib
#define X first
#define Y second
#define L (u1)
#define R (u1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].ltr[u].r1)
#define Len(u) (tr[u].r-tr[u].l1)
#define random(a,b) ((a)rand()%((b)-(a)1))
#define db puts(---)
using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); }
//void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); }
//void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pairint,int PII;const int N1000010,INF0x3f3f3f3f;
const double eps1e-6;int n,mod;
LL ans1;int main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);int _; cin_;while(_--) {cinnmod;int d(int)log2(n);ans1%mod;for(int i0;id;i) {if(id) ans*((1ll(i1))-(1lli)1)%mod,ans%mod;else ans*(n-(1lli)2)%mod,ans%mod;}ans-1; ansmod; ans%mod;coutansendl;}return 0;
}
/**/
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/926618.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!