自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 离散化数组

通过数组离散化操作解决数组需要开的空间过大导致内存不足

2024-03-12 17:45:55 603 1

原创 素数判定2012

对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39

2023-09-02 19:29:12 87

原创 绝对值排序

输入n(n

2023-08-25 19:49:52 1251 1

原创 矩阵的快速幂

矩阵的快速幂前置知识:1. 基本快速幂2. c++运算符重载3. 幺元基本概念(任何一个数乘以幺元等于本身)#include"iostream"using namespace std;const int mod = 1e9 + 7;struct mat{ long long int a[110][110];}unit;int n;mat operator * (mat v1, mat v2) //重载 乘法 运算符{ mat ret; long long int x; for

2021-08-04 11:32:41 114

原创 洛谷P3368

线段树模板题首先确定存储类型struct node{ int l;//左端点 int r;//右端点 int sum;//区间求和 int tag;//懒人标记}tree[Maxn*4];//需要四倍空间第二部建树void BuildTree(int l,int r,int u){ tree[u].l = l; tree[u].r = r; tree[u].tag = 0; if(l==r) { tree[u].sum = a[l]; return ; } i

2021-08-02 10:00:10 158

原创 codeforces-1433B

Yet Another BookshelfThere is a bookshelf which can fit n books. The i-th position of bookshelf is ai=1 if there is a book on this position and ai=0 otherwise. It is guaranteed that there is at least one book on the bookshelf.In one move, you can choose

2020-11-03 19:26:03 223

原创 hdu2064

汉诺塔IIIProblem Description约19世纪末,在欧州的商店中出售一种智力玩具,在一块铜板上有三根杆,最左边的杆上自上而下、由小到大顺序串着由64个圆盘构成的塔。目的是将最左边杆上的盘全部移到右边的杆上,条件是一次只能移动一个盘,且不允许大盘放在小盘的上面。现在我们改变游戏的玩法,不允许直接从最左(右)边移到最右(左)边(每次移动一定是移到中间杆或从中间移出),也不允许大盘放到下盘的上面。Daisy已经做过原来的汉诺塔问题和汉诺塔II,但碰到这个问题时,她想了很久都不能解决,现在请你

2020-10-21 21:31:48 196

原创 hdu2018

母牛的故事Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述。n=0表示输入数据的结束,不做处理。Output对于每个测试实例,输出在第n年的时候母牛的数量。每个输出占一行。Sample Input2450Sample Output246

2020-10-21 21:03:46 112

原创 zoj3785

What day is that day?It’s Saturday today, what day is it after 11 + 22 + 33 + … + NN days?InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:There is only one line c

2020-10-19 20:52:32 101

原创 hdu6553

Tangram一块七巧板有 7 块,现在 wls 想再在七巧板上加 n 条直线将七巧板切分并且使得切出来的块最多,请问最多能有多少块?Input输入有多组(不超过 100, 000组)。每组一行一个正整数 n。0 ≤ n≤ 1, 000, 000, 000Output每组输出一行一个数代表答案。Sample Input1Sample Output13Source2019中国大学生程序设计竞赛-女生专场(重现赛)-感谢南京晓庄学院AC代码#include"iostream"#i

2020-10-19 20:39:58 235

原创 hdu6554

Tetriswls 有一个 n ∗ m 的网格,他现在想用俄罗斯方块中的"凸"型密铺它。一个"凸"型占四个格子,你可以随意把它调成上下左右四个方向中的一个。密铺的定义是网格中任意一个格子被且只被一个"凸"型铺到,并且这些"凸"型不能铺出网格的边界。随意输出一组解即可。Input一行两个整数 n, m。1 ≤ n, m ≤ 12output无解输出 no response。如果有解,输出 n 行,每行 m 个字符。你只能使用 1, 2, 3, 4 这四个字符,由同 一字符组成的四连通块被视

2020-10-18 20:37:25 174

原创 hdu2028

Lowest Common Multiple PlusProblem Description求n个数的最小公倍数。Input输入包含多个测试实例,每个测试实例的开始是一个正整数n,然后是n个正整数。Output为每组测试数据输出它们的最小公倍数,每个测试实例的输出占一行。你可以假设最后的输出是一个32位的整数。Sample Input2 4 63 2 5 7Sample Output1270AuthorlcyAC代码#include"iostream"using names

2020-10-16 17:00:42 110

原创 hdu5551(Huatuo‘s Medicine)

Huatuo’s MedicineHuatuo was a famous doctor. He use identical bottles to carry the medicine. There are different types of medicine. Huatuo put medicines into the bottles and chain these bottles together.However, there was a critical problem. When Huatuo

2020-10-15 18:41:55 147

原创 快速幂(取模)

快速幂int fastpow(int a,int n){ int base = a; int res = 1; while(n) { if(n&1) res *= base; base *= base; n>>=1; } return res;}(1)n&1(二进制运算),取n的最后一位,判断这一位是否需要跳过(2)n>>=1,把n右移一位,把刚刚处理过的n的最后一位去掉模运算加:(a+b)mod m = ((a mod

2020-10-15 12:37:39 98

原创 素数判断--试除法

简单素数判断试除法bool is_prime(int n){ if(n<=1) //1不是素数 return false; for(int i = 2;i*i<=n;i++) if(n % i ==0) return false; return true;}

2020-10-15 12:10:20 699

原创 hdu5540

Secrete Master PlanMaster Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan instructs how to deploy soldiers on the four corners of the city wall. Unfortunately, when Fei opened the pocket he found there are only four number

2020-10-15 09:26:41 143

原创 最大公约数与最小公倍数--简单求解

最大公约数求解int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}最小公倍数int lcm(int a,int b){ return a/gcd(a,b)*b;}

2020-10-15 09:09:10 120

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除