我从前最怕旁人火眼金睛,如今,倒是盼着有人能够洞幽烛远。如此,就能赠我一点欢喜。

链接:https://ac.nowcoder.com/acm/problem/14654
来源:牛客网

题目描述

DD wants to send a gift to his best friend CC as her birthday is coming. However, he can’t afford expensive gifts, and he is so lazy that he is not willing to do complex things. So he decides to prepare a paper cut for CC’s birthday gift, which symbolizes their great friendship~~

DD has a square colored paper which consists of n*n small squares. Due to his tastes, he wants to cut the paper into two identical pieces. DD also wants to cut as many different figures as he can but each sheet can be only cut once, so he asks you how many sheets does he need to prepare at most.

for example:

输入描述:

Input contains multiple test cases.
The first line contains an integer T (1<=T<=20), which is the number of test cases.Then the first line of each test case contains an integer n (1<=n<10).

输出描述:

The answer;

示例1

输入

复制

1
4

输出

复制

11
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <ctime>
#include <cctype>
#include <bitset>
#include <utility>
#include <sstream>
#include <complex>
#include <iomanip>
#define inf 0x7ffffff
#define P pair<int,int>
typedef long long ll;
using namespace std;
const ll MOD=1e9+7;
int T,n,vis[15][15],jg;
int fx[4][2]={0,1,1,0,0,-1,-1,0};
int fy[4][2]={0,-1,-1,0,0,1,1,0};
bool check(int x,int y){if(x<0||x>n||y<0||y>n||vis[x][y])return false;return true;
}
void dfs(int x1,int y1,int x2,int y2){if(x1==0||x1==n||y1==0||y1==n){jg++;return;}vis[x1][y1]=vis[x2][y2]=1;for(int i=0;i<4;i++){int X1=x1+fx[i][0];int Y1=y1+fx[i][1];int X2=x2+fy[i][0];int Y2=y2+fy[i][1];if(!check(X1, Y1)||!check(X2, Y2)) continue;dfs(X1,Y1,X2,Y2);}vis[x1][y1]=vis[x2][y2]=0;
}
int main()
{scanf("%d",&T);while(T--){scanf("%d",&n);if(n%2){printf("0\n");continue;}jg=0;dfs(n/2,n/2,n/2,n/2);printf("%d\n",jg/4);}return 0;
}

链接:https://ac.nowcoder.com/acm/problem/14675
来源:牛客网

题目描述

圣诞节临近,彩虹岛的黑心商人

牛客每日练习----剪纸,圣诞节糖果,裁缝大师相关推荐

  1. 力扣牛客每日刷题(Python解法持续更新)

    力扣牛客每日刷题(持续更新) 初试结束第15天, 之前简单的处理了部分毕设方面的任务, 对接下来的学习做了个简单的规划 决定每天开始刷几道力扣题提高一下算法的理解,不能让之前学的数据结构都忘记了 每道 ...

  2. 牛客每日练习----​​​​​​​最长回文,Alice和Bob赌糖果,N阶汉诺塔变形

    也许,年少时不能遇见太过惊艳的人,就像你不能做我的诗,而我无法成为你的梦! 链接:https://ac.nowcoder.com/acm/problem/14894 来源:牛客网 题目描述 有两个长度 ...

  3. 【牛客每日一题】4.16 逆序对 ( 数学 , 排列组合 ,快速幂 , 快速乘 )

    [每日一题]逆序对 链接:https://ac.nowcoder.com/acm/problem/14731 来源:牛客网 题目描述 求所有长度为n的01串中满足如下条件的二元组个数: 设第i位和第j ...

  4. 【牛客每日一题】4.15 Treepath 题解(树上dfs/树形DP)

    题目链接:https://ac.nowcoder.com/acm/problem/14248 来源:牛客网 题目描述 给定一棵n个点的树,问其中有多少条长度为偶数的路径.路径的长度为经过的边的条数.x ...

  5. 【牛客每日一题】 4.13 Xorto(前缀异或和,枚举优化/映射)

    链接:https://ac.nowcoder.com/acm/problem/14247 来源:牛客网 题目描述 给定一个长度为n的整数数组,问有多少对互不重叠的非空区间,使得两个区间内的数的异或和为 ...

  6. 【牛客每日一题】tokitsukaze and Soldier 题目精讲 贪心、优先队列、堆

    链接:https://ac.nowcoder.com/acm/problem/50439 来源:牛客网 ACM在线模板 今天才发现牛客推出了一个每日一题的版块,3月25号就开始了,今天才发现,赶紧补救 ...

  7. 牛客每日一题3.31 城市网络 树上倍增

    牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 有一个树状的城市网络(即 n 个城 ...

  8. 牛客每日练习----あなたの蛙が帰っています,おみやげをまらいました,写真がとどいています

    我喜欢给自己压力,必须得定一个很高的目标,逼自己朝着这个目标前进,不管会不会实现,都是一个动力.                                      ----喻言 链接:http ...

  9. 牛客每日练习----圆圈​​​​​​​,TaoTao要吃鸡,吐泡泡

    我喜欢给自己压力,必须得定一个很高的目标,逼自己朝着这个目标前进,不管会不会实现,都是一个动力.                                      ----喻言 链接:http ...

最新文章

  1. u32和字符串的转换函数
  2. 业务需求、客户需求与功能需求
  3. linux授权文件夹给用户_一项一项教你测等保2.0——Linux访问控制
  4. elasticsearch-jdbc实现MySQL同步到ElasticSearch深入详解
  5. Android开发之ApiCloud轮播图开发
  6. springmvc02
  7. 系统同传软件_如何戴耳机录制自己的同传练习?
  8. 【转】从 ArcGIS for Desktop 发布地图服务
  9. 在张学友演唱会的6万观众中,AI锁定了一名逃犯
  10. XyPlayer 智能解析 X4 影视解析源码
  11. Android小知识10则(上)(2018.8重编版)
  12. SQL Server商业智能–简介
  13. 华为服务器设置iBMC管理网口IP地址,开启Monitor图文教程
  14. 每周收获(11-13)
  15. python用来正常显示中文标签 plt.rcParams['font.sans-serif'] = ['SimHei']错误
  16. 如何提取NC中的数据不同维度信息(如:变量、时间等
  17. Kubernetes in Action 免积分下载
  18. 计算机usb无法读取u盘启动,U盘无法识别的USB设备怎么办解决
  19. Visualizing Search Results with Solr /browse Velocity
  20. JavaScript 是怎么运行起来的?

热门文章

  1. 如何使用HTTP协议,读写PLC点位状态(含欧姆龙、三菱、西门子、施耐德、松下等PLC)
  2. Matlab 数值计算—积分
  3. 基于大规模语料的新词发现算法【转自matix67】
  4. 老游戏的新生:探究二十年前的经典游戏为何再次风靡
  5. 微软为何钟情开源技术?
  6. 关于动态音乐设计的思考-Part 1-设计分类学
  7. NORDFLASH与NANDFLASH的区别及选型
  8. 滚动截屏苹果_苹果为iPhone添加了“秘密”按钮,你学会使用了吗?
  9. 基于javaFX的生鲜销售系统
  10. java现代编译原理pdf脚本之家,两周自制脚本语言 PDF 高清版