当前位置:网站首页>Array splitting (regular thinking
Array splitting (regular thinking
2022-07-02 11:11:00 【lcxdz】
#include <bits/stdc++.h>
using namespace std;
map<string, bool> vis;
int ans = 1;
#define int long long
typedef long long ll;
string to(string s, int a, int b)
{
string ne = s;
ne += '0' + a;
ne += '0' + b;
return ne;
}
void bfs(int n)
{
queue<string> q;
q.push("88");
while (q.size())
{
auto x = q.front();
q.pop();
if (vis[x] == 1)
continue;
vis[x]=1;
ans++;
cout<<x<<endl;
string c;
for (int i = 0; i < x.size(); i++)
{
if (x[i] != '1')
{
int p = x[i] - '0';
int a = p / 2, b = p - p / 2;
string ne = to(c, a, b);
if (i + 1 < x.size())
ne += x.substr(i + 1);
if (vis.find(ne)==vis.end())
{
q.push(ne);
}
if (a != b)
{
swap(a, b);
string mc = to(c, a, b);
if (i + 1 < x.size())
mc += x.substr(i + 1);
if (vis.find(mc)==vis.end())
{
q.push(mc);
}
}
}
c += x[i];
}
}
}
signed main()
{
int n=1152921504606846976,mod=1e9+7;
// cin >> n;
// bfs(n);
// cout<<"---"<<ans<<endl;
int p=2;
for(int i=4;i<=n;i*=2){
p=(p*p+1)%mod;
if(i==n)break;
}
cout<<p<<endl;
return 0;
}
边栏推荐
- JVM之垃圾回收器
- Resources读取2d纹理 转换为png格式
- 6种单例模式的实现方式
- [play with FPGA learning 4 in simple terms ----- talk about state machine design]
- 最详细MySql安装教程
- Special topic of binary tree -- acwing 19 The next node of the binary tree (find the successor of the node in the tree)
- QT学习日记8——资源文件添加
- 力扣(LeetCode)182. 查找重复的电子邮箱(2022.07.01)
- Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)
- TIPC messaging3
猜你喜欢

QT learning diary 8 - resource file addition
![[in simple terms, play with FPGA learning 3 ----- basic grammar]](/img/f0/0204fa5197033877dc0758203253ae.png)
[in simple terms, play with FPGA learning 3 ----- basic grammar]

Uncover the secrets of Huawei application market application statistics

How to implement tabbar title bar with list component

Huawei game failed to initialize init with error code 907135000

QT学习日记7——QMainWindow

HDU1236 排名(结构体排序)

Hdu1228 a + B (map mapping)

Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)

如何用list组件实现tabbar标题栏
随机推荐
[in simple terms, play with FPGA learning 3 ----- basic grammar]
HDU1234 开门人和关门人(水题)
PCL point cloud to depth image
2022-06-17
三.芯片啟動和時鐘系統
Primary key policy problem
Hdu1234 door opener and door closer (water question)
函数式接口和方法引用
Jsp webshell Free from killing - The Foundation of JSP
【AGC】构建服务3-认证服务示例
Jenkins安装
Creation and use of unified links in Huawei applinking
【快应用】text组件里的文字很多,旁边的div样式会被拉伸如何解决
二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)
Special topic of binary tree -- acwing 3540 Binary search tree building (use the board to build a binary search tree and output the pre -, middle -, and post sequence traversal)
flink二開,實現了個 batch lookup join(附源碼)
洛谷 P4281 [AHOI2008]紧急集合 / 聚会(树上倍增 LCA)
最详细MySql安装教程
HDU1236 排名(结构体排序)
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)