自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 完数与盈数(时间复杂度极低的算法)

题目描述一个数如果恰好等于它的各因子(该数本身除外)子和,如:6=3+2+1,则称其为“完数”;若因子之和大于该数,则称其为“盈数”。求出2 到60 之间所有“完数”和“盈数”,并以如下形式输出: E: e1 e2 e3 …(ei 为完数) G: g1 g2 g3 …(gi 为盈数)输入无输出按描述要求输出(注意EG后面的冒号之后有一个空格)。如果题目范围为2~n,当n很大时,普通的方法会需要很长时间对因子进行求和。以下算法更好。```cpp#include <stdio.h&g

2021-02-16 15:25:45 267

原创 各种排序算法

各种排序算法#include <stdio.h>void DirectInsertSort(int a[], int n){ int temp; for(int i = 1; i < n; i++){ temp = a[i]; int j; for(j = i - 1; j >= 0 && a[j] > temp; j--) a[j + 1] = a[j];

2020-11-18 21:27:56 141

原创 快速幂取模的迭代方法

#include <stdio.h>typedef long long LL;LL pow(LL a, LL b, LL m){ LL ans = 1; for(int i = 0; i < b; i++){ ans = ans * a % m; } return ans;}int BinaryPow(int a, int b, int m){ if(b == 0) return 1; if(b &

2020-06-26 19:08:15 188

原创 写代码的时候打错字,好烦

//快速求a^b%m```cpp#include <stdio.h>typedef long long LL;LL pow(LL a, LL b, LL m){ LL ans = 1; for(int i = 0; i < b; i++){ ans = ans * a % m; } return ans;}int BinaryPow(int a, int b, int m){ if(b == 0) return

2020-06-24 22:40:57 291

原创 codeup

问题 C: To Fill or Not to Fill[命题人 : 外部导入]时间限制 : 1.000 sec 内存限制 : 32 MB题目描述With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time

2020-06-15 00:59:03 136

原创 C++ 中取余%运算

c++ (G++)中 -2 % 7 = -2,而不是5;所以必要的时候应该再加7.

2020-03-26 20:06:47 1800

原创 codeup

题目描述Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, “helloworld” can be printed as:h de ll rlowoThat is, the characters must ...

2020-03-11 22:29:22 122

原创 三维字符数组

题目描述输入N个学生的信息,然后进行查询。输入输入的第一行为N,即学生的个数(N<=1000)接下来的N行包括N个学生的信息,信息格式如下:01 李江 男 2102 刘唐 男 2303 张军 男 1904 王娜 女 19然后输入一个M(M<=10000),接下来会有M行,代表M次查询,每行输入一个学号,格式如下:02030104输出输出M行,每行包括一个对...

2020-03-07 23:40:44 2540

空空如也

空空如也

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

TA关注的人

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