当前位置:网站首页>[51nod] 3395 n-bit gray code
[51nod] 3395 n-bit gray code
2022-06-24 02:49:00 【SSL_ GYX】
n Bit code

Their thinking
If a digit is equal to the previous digit , Then this one is 1 1 1 , It is 0 0 0 , Can be done with or .
code
#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
int n;
void output(int x)
{
int a[20],tot=0;
while(x) a[++tot]=x%2,x>>=1;
for(int i=n;i>tot;i--) printf("0");
while(tot) printf("%lld",a[tot--]);
printf("\n");
}
signed main()
{
cin>>n;
for(int i=0;i<(1<<n);i++)
output(i^(i>>1));
}
边栏推荐
- 2022-2028 global cancer biopsy instrument and kit industry research and trend analysis report
- Compile blender source code
- Grpc: based on cloud native environment, distinguish configuration files
- What are the performance characteristics of cloud desktop? How to choose the most cost-effective cloud desktop server?
- 2022-2028 global aircraft front wheel steering system industry research and trend analysis report
- MySQL case deep excavation information_ Root causes of slow schema view query (Part 2)
- Tencent Youtu won the champion of iccv2021 LVIs challenge workshop and the best innovation award of the project
- Gin framework: add Prometheus monitoring
- Efficient Internet access and systematic learning
- 2022-2028 global anti counterfeiting label industry research and trend analysis report
猜你喜欢

2022-2028 global third-party data platform industry research and trend analysis report

2022-2028 global indoor pressure monitor and environmental monitor industry research and trend analysis report
Cloudpods golang practice

2022-2028 global anti counterfeiting label industry research and trend analysis report

2022-2028 global marine wet exhaust hose industry research and trend analysis report

2022-2028 global aircraft front wheel steering system industry research and trend analysis report

2022-2028 global cancer biopsy instrument and kit industry research and trend analysis report

2022-2028 global marine clutch industry research and trend analysis report

2022-2028 Global Industry Survey and trend analysis report on portable pressure monitors for wards

Permission maintenance topic: domain controller permission maintenance
随机推荐
How to transfer files from the server connected to the fortress machine and how to access the server through the fortress machine
What are the main functions of DNS? What are the benefits of IP address translation
Gin framework: RPC error code design
MySQL Cases-MySQL 8.0.26 bug ERROR 1064 (42000) at line1: You have an error
How does easynvr call the interface to modify a user-defined page?
Operation and maintenance platform tcapulusdb transaction management
Solution to session problem of missing laravel jump page
What is the meaning of scdo? Is it comparable to bGH
How to log in the remote server of Fortress machine working principle of Fortress machine
2022-2028 Global Industry Survey and trend analysis report on portable pressure monitors for wards
Mysql Find_ IN_ Set function
How to build a private cloud desktop with a server? How to use cloud desktop?
How to enable IPv6 network access for personal broadband
Can cloud computing scale flexibly? What are the characteristics of elasticity?
Gartner released the magic quadrant of enterprise low code platform in 2021. Low code integrated platform becomes a trend!
How to use nsfilemanager
How to apply for top-level domain names? What are the types of top-level domain names?
SAP retail characteristic profile I
Block
[supply chain • case] Tianneng group: the key to understanding the leading battery manufacturer to achieve the first profit fault