随笔 - 164  文章 - 0  评论 - 4  阅读 - 9913

牛客小白月赛75-C

C 方豆子

题意
按照题意模拟,详见链接
思路
看到的第一眼就想递归,之后发现稍微有点麻烦没那么直接
难度不高,模拟水题
代码

//>>>Qiansui
#include<map>
#include<set>
#include<list>
#include<stack>
#include<cmath>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<utility>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<functional>
#define ll long long
#define ull unsigned long long
#define mem(x,y) memset(x,y,sizeof(x))
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << " " << #y << " = "<< y << endl
//#define int long long
inline ll read()
{
ll x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-48;ch=getchar();}
return x*f;
}
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ull,ull> pull;
typedef pair<double,double> pdd;
/*
*/
const int maxm=3*(1<<10)+5,inf=0x3f3f3f3f,mod=998244353;
ll n;
string ss[2],ans[maxm];
void add(int x,int y){
ans[x]+=ss[y]+ss[y];
ans[x+1]+=ss[y]+ss[y];
ans[x+2]+=ss[y]+ss[y];
ans[x+3]+=ss[y]+ss[1-y];
ans[x+4]+=ss[y]+ss[1-y];
ans[x+5]+=ss[y]+ss[1-y];
return ;
}
void get(int x,int y,int i){
if(x==1){
add(i,y);
}else{
get(x-1,1-y,i);
get(x-1,1-y,i);
get(x-1,1-y,i+3*pow(2,x-1));
get(x-1,y,i+3*pow(2,x-1));
}
return ;
}
void solve(){
cin>>n;
ss[1]="***";
ss[0]="...";
get(n,1,1);
ll t=3*pow(2,n);
for(int i=1;i<=t;++i){
cout<<ans[i]<<'\n';
}
return ;
}
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int _=1;
// cin>>_;
while(_--){
solve();
}
return 0;
}
posted on   Qiansui  阅读(45)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· Apache Tomcat RCE漏洞复现(CVE-2025-24813)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示