Boring Game
参考:https://blog.csdn.net/qq_45458915/article/details/107804348
模拟题
给出 n 张叠在一起的纸,现在将其连续从左向右折叠 k 次,再从上到下标上序号,问展开后的序号是怎么样的
可以把展开看作一条纸带对折多次后形成的样子。
未通过,写完还是OT
附未通过代码
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
//#define sort(a,n,int) sort(a,a+n,less<int>()) #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db; const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10;
const int N=1e6+10;
const int mod=1e9+7; vector<int> node[N];
int main()
{
int T = 0;
cin >> T;
while(T--)
{
int n , k , L;
cin >> n >> k;
L = n << (k+1);
for(int i = 1;i <= L;i++)
{
node[i].clear();
int x;
cin >> x;
node[i].push_back(x);
}
int mid = 1;
int p = 0;
for(int i = 1;i <= k;i++)
{
mid = (mid + L)/2;
for(int j = mid + 1;j <= L;j++)
{
p = mid - (j - (mid+1));
reverse(node[p].begin() , node[p].end());
node[j].insert(node[j].begin() , node[p].begin() , node[p].end());
node[p].clear();
}
}
for(int i = L-n*2+1;i <= L;i++)
{
for(int j = 0;j < node[i].size();j++)
{
if(j == node[i].size()-1 && i == L)
{
cout << node[i][j];
}
else
{
cout << node[i][j] <<" ";
}
}
}
cout << endl;
}
}
Boring Game的更多相关文章
- hihoCoder 1430 : A Boring Problem(一琐繁题)
hihoCoder #1430 : A Boring Problem(一琐繁题) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 As a ...
- sdut 2610:Boring Counting(第四届山东省省赛原题,划分树 + 二分)
Boring Counting Time Limit: 3000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 In this problem you a ...
- HDU 4358 Boring counting(莫队+DFS序+离散化)
Boring counting Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 98304/98304 K (Java/Others) ...
- sdutoj 2610 Boring Counting
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2610 Boring Counting Time ...
- hdu 4358 Boring counting dfs序+莫队+离散化
Boring counting Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 98304/98304 K (Java/Others) ...
- [2015hdu多校联赛补题]hdu5324 Boring Class
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5324 题意:给你一个二维的序列,让你找出最长的第一维升第二维降的子序列(如果多个答案,输出字典序最小) ...
- 后缀数组 --- HDU 3518 Boring counting
Boring counting Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=3518 Mean: 给你一个字符串,求:至少出 ...
- HDU 5793 A Boring Question (逆元+快速幂+费马小定理) ---2016杭电多校联合第六场
A Boring Question Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- SDUT 2610 Boring Counting(离散化+主席树区间内的区间求和)
Boring Counting Time Limit: 3000MS Memory Limit: 65536KB Submit Statistic Discuss Problem Descriptio ...
- Boring count(字符串处理)
Boring count Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
随机推荐
- JuiceFS 企业版 5.2:迈入千亿文件时代,稳定性与性能再升级,首次支持 Windows 客户端
JuiceFS 企业版 5.2 版本近日发布,文件管理规模迈入千亿级.此次升级重点提升了超大规模集群的稳定性,优化了分布式缓存的网络性能,并增强了系统的易用性与安全性,旨在支持高并发访问等复杂的高性能 ...
- 洛谷 P1549 [NOIP1997 提高组] 棋盘问题
洛谷 P1549 [NOIP1997 提高组] 棋盘问题 Problem 构造一个\(n\times n(n\le 10)\)的矩阵,在矩阵中填入\(1,2,\dots,n^2\),使得任意相邻的数之 ...
- flutter3-winseek客户端AI实例|Flutter3.32+DeepSeek流式ai对话模板Exe
原创首发flutter3+deepseek+window_manager客户端Ai流式打字Flutter-WinSeek. flutter3-winseek-chat:基于flutter3.32+da ...
- maixpy 常用API整理
2.openmvAPI整理 2.1 cmath - 复数的数学函数 cos cmath.cos(z) 返回z的余弦. exp cmath.exp(z) 返回z的指数. log cmath.log(z) ...
- 「Note」图论方向 - 图论基础
1. 差分约束 1.1. 简介 差分约束算法用于解决如下问题:给出若干形如 \(x_a-x_b\le c\) (均为整数,可以为负数)的不等式,求一组解 \(\{x_i\}\),若不存在解则判断无解. ...
- Go中的数组和切片
本文参考: https://www.liwenzhou.com/posts/Go/05_array/ https://www.liwenzhou.com/posts/Go/06_slice/ Arra ...
- C# DataGridView 控制只能选择一行
https://www.it1352.com/1112692.html multiselectchanged方法的值false 将DataGridView的 SelectionMode 更改为当用户点 ...
- Vue+ts 引用外部的js 文件
export default defineComponent({ name: 'App', components: { Signin, Navbar, FooterPage, BackToTopBut ...
- vue开发组件并发包到npm
其实很早之前就做过,时间久了,就忘记了.这次复习,做个笔记官方文档:https://cli.vuejs.org/zh/guide/build-targets.html#%E5%BA%93 创建组件项目 ...
- java 双亲委派机制 & 与打破
简介 当某个类加载器需要加载某个.class文件时, 它首先把这个任务委托给他的上级类加载器,递归这个操作,如果上级的类加载器没有加载,自己才会去加载这个类. 参考链接 https://www.jia ...