当前位置:网站首页>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;
}
边栏推荐
- MTK full dump抓取
- static 函数中的静态变量
- 【快应用】text组件里的文字很多,旁边的div样式会被拉伸如何解决
- 洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
- Jsp webshell Free from killing - The Foundation of JSP
- Logu p3398 hamster looks for sugar (double LCA on the tree to judge whether the two paths in the tree intersect)
- What are the software product management systems? Inventory of 12 best product management tools
- [AI application] Hikvision ivms-4200 software installation
- Implement custom drawer component in quick application
- III Chip startup and clock system
猜你喜欢
TIPC 寻址2
如何使用IDE自动签名调试鸿蒙应用
OpenMLDB Meetup No.4 会议纪要
TIPC Service and Topology Tracking4
【深入浅出玩转FPGA学习5-----复位设计】
Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)
Jsp webshell Free from killing - The Foundation of JSP
TIPC messaging3
【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
How does the whole network display IP ownership?
随机推荐
PCL extracts a subset from a point cloud
华为联机对战服务玩家掉线重连案例总结
Hdu1236 ranking (structure Sorting)
flink二开,实现了个 batch lookup join(附源码)
最详细MySql安装教程
Hdu1234 door opener and door closer (water question)
LVM操作
洛谷 P5536 【XR-3】核心城市(贪心 + 树形 dp 寻找树的中心)
【ARK UI】HarmonyOS ETS的启动页的实现
高德根据轨迹画线
TIPC protocol
二叉树专题--AcWing 1497. 树的遍历(利用后、中序遍历,构建二叉树)
Implement custom drawer component in quick application
软件产品管理系统有哪些?12个最佳产品管理工具盘点
Leetcode 182 Find duplicate email (2022.07.01)
点云投影图片
【深入浅出玩转FPGA学习3-----基本语法】
[AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?
Point cloud projection picture
【AppLinking实战案例】通过AppLinking分享应用内图片