题目链接:https://vjudge.net/problem/HDU-6862

题意: 由六边形组成的圆形图案,要求不重复走遍历每一个小六边形。

思路:https://www.cnblogs.com/ExileTerminus/p/13527879.html

  1 #include <bits/stdc++.h>
2 #include <time.h>
3 #include <set>
4 #include <map>
5 #include <stack>
6 #include <cmath>
7 #include <queue>
8 #include <cstdio>
9 #include <string>
10 #include <vector>
11 #include <cstring>
12 #include <utility>
13 #include <cstring>
14 #include <iostream>
15 #include <algorithm>
16 #include <list>
17 using namespace std;
18 //cout<<setprecision(10)<<fixed;
19 #define eps 1e-6
20 #define PI acos(-1.0)
21 #define lowbit(x) ((x)&(-x))
22 #define zero(x) (((x)>0?(x):-(x))<eps)
23 #define mem(s,n) memset(s,n,sizeof s);
24 #define rep(i,a,b) for(int i=a;i<=b;i++)
25 #define rep2(i,a,b) for(int i=a;i>=b;i--)
26 #define ios {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
27 typedef long long ll;
28 typedef unsigned long long ull;
29 const int maxn=1e6+5;
30 const ll Inf=0x7f7f7f7f7f7f7f7f;
31 const ll mod=1e6+3;
32 //const int N=3e3+5;
33 bool isPowerOfTwo(int n) { return n > 0 && (n & (n - 1)) == 0; }//判断一个数是不是 2 的正整数次幂
34 int modPowerOfTwo(int x, int mod) { return x & (mod - 1); }//对 2 的非负整数次幂取模
35 int getBit(int a, int b) { return (a >> b) & 1; }// 获取 a 的第 b 位,最低位编号为 0
36 int Max(int a, int b) { return b & ((a - b) >> 31) | a & (~(a - b) >> 31); }// 如果 a>=b,(a-b)>>31 为 0,否则为 -1
37 int Min(int a, int b) { return a & ((a - b) >> 31) | b & (~(a - b) >> 31); }
38 ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
39 ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
40 inline int read()
41 {
42 int X=0; bool flag=1; char ch=getchar();
43 while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
44 while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
45 if(flag) return X;
46 return ~(X-1);
47 }
48 inline void write(int X)
49 {
50 if(X<0) {X=~(X-1); putchar('-');}
51 if(X>9) write(X/10);
52 putchar(X%10+'0');
53 }
54 /*
55 inline int write(int X)
56 {
57 if(X<0) {putchar('-'); X=~(X-1);}
58 int s[20],top=0;
59 while(X) {s[++top]=X%10; X/=10;}
60 if(!top) s[++top]=0;
61 while(top) putchar(s[top--]+'0');
62 }
63 */
64 int Abs(int n) {
65 return (n ^ (n >> 31)) - (n >> 31);
66 /* n>>31 取得 n 的符号,若 n 为正数,n>>31 等于 0,若 n 为负数,n>>31 等于 -1
67 若 n 为正数 n^0=n, 数不变,若 n 为负数有 n^(-1)
68 需要计算 n 和 -1 的补码,然后进行异或运算,
69 结果 n 变号并且为 n 的绝对值减 1,再减去 -1 就是绝对值 */
70 }
71 ll binpow(ll a, ll b) {
72 ll res = 1;
73 while (b > 0) {
74 if (b & 1) res = res * a%mod;
75 a = a * a%mod;
76 b >>= 1;
77 }
78 return res%mod;
79 }
80 void extend_gcd(ll a,ll b,ll &x,ll &y)
81 {
82 if(b==0) {
83 x=1,y=0;
84 return;
85 }
86 extend_gcd(b,a%b,x,y);
87 ll tmp=x;
88 x=y;
89 y=tmp-(a/b)*y;
90 }
91 ll mod_inverse(ll a,ll m)
92 {
93 ll x,y;
94 extend_gcd(a,m,x,y);
95 return (m+x%m)%m;
96 }
97 ll eulor(ll x)
98 {
99 ll cnt=x;
100 ll ma=sqrt(x);
101 for(int i=2;i<=ma;i++)
102 {
103 if(x%i==0) cnt=cnt/i*(i-1);
104 while(x%i==0) x/=i;
105 }
106 if(x>1) cnt=cnt/x*(x-1);
107 return cnt;
108 }
109 void solve(int n)
110 {
111 if(n==2) {puts("543215");return;}
112 if(n==1) {puts("");return;}
113 printf("5");
114 for(int i=1;i<=n-2;i++) printf("46");
115 printf("4");
116 for(int i=1;i<=n-2;i++) printf("35");
117 printf("3");
118 for(int i=1;i<=n-2;i++) printf("24");
119 printf("2");
120 for(int i=1;i<=n-2;i++) printf("13");
121 printf("1");
122 for(int i=1;i<=n-2;i++) printf("62");
123 printf("6");
124 for(int i=1;i<=n-3;i++) printf("51");
125 printf("54");
126 solve(n-2);
127 }
128 int main() {
129 int t=read();
130 while(t--)
131 {
132 int n=read();
133 solve(n);
134 }
135 return 0;
136 }

Hexagon HDU - 6862的更多相关文章

  1. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  2. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  3. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  4. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  5. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  6. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  7. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

  8. HDU 3791二叉搜索树解题(解题报告)

    1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...

  9. hdu 4329

    problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟  a.     p(r)=   R'/i   rel(r)=(1||0)  R ...

随机推荐

  1. K8s(一)----容器编排工具基础概念

    kubernetes(k8s)容器编排工具基础概念 Kubernetes (K8s): 中文社区:https://www.kubernetes.org.cn/replication-controlle ...

  2. Tomcat基本原理

    思考 :怎样让Tomcat具备Web服务的功能呢? 在服务端用HTTP来监听,协议不好写,不妨用Java封装好的Socket作为监听. class MyTomcat{ ServerSocket ser ...

  3. 017.NET5_内置容器基本使用

    IOC容器IServiceCollection .net 5已经内置了IOC容器. 什么是IOC? 把对象的创建交给第三方容器去创建 如何使用内置的 IOC IServiceCollection ? ...

  4. how to publish a dart package using Github Actions?

    how to publish a dart package using Github Actions? dart package flutter package Github Actions publ ...

  5. codepen iframe theme id

    codepen iframe theme id iframe css theme demos See the Pen css margin collapsing (1. 相邻兄弟元素) by xgqf ...

  6. js 上传图片,用户自定义截取图片大小

    js 上传图片,用户自定义截取图片大小 js 组件

  7. 解析js字符串

    myEval export const evalExp = /[!\&\|\+\-\*\%=\/<\>\^\(\)\~\:\?\;]/g; export function myEv ...

  8. Dart: puppeteer库

    和node的差不多,只有写API不一样 puppeteer 地址 安装依赖 dependencies: puppeteer: ^1.7.1 下载 chrome-win 到 <project_ro ...

  9. 应该如何看待VAST的未来价格与价值?

    提起数字货币的价格,很多币圈人士都是滔滔不绝,随口一举例,便是百倍千倍的数字货币.可是提起数字货币的价值,就很少有币圈人士能举出几个有力的例子,常常顾左右而言他,场面十分尴尬.之所以会这样,是因为很多 ...

  10. 一层逻辑的网页scrapy爬虫

    1 import scrapy 2 import re 3 from fake_useragent import UserAgent 4 5 6 class DoubanSpider(scrapy.S ...