牛客小白月赛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; }
本文来自博客园,作者:Qiansui,转载请注明原文链接:https://www.cnblogs.com/Qiansui/p/17518023.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· Apache Tomcat RCE漏洞复现(CVE-2025-24813)