自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 求a^n的尾数

1.普通方法:#includeusing namespace std;int main(){ int a,n; cin>>a>>n; int i=0; int num=0; int a1=a; a=a%10; while(num<n-1) { a=a*a1; while(a>=10) a%=10; num++; } cout<<"a="<<a<<end

2017-10-21 14:29:58 264

原创 循环右移

循环右移k 位问题老师参与下面的算法(文字叙述形式),用来将数组a[n]的每个元素都循环地右移k位,这里1≤k≤n。算法描述如下:步骤1) 将数组分成两段,左段长为n-k,右段长为k。步骤2) 分别将两段逆转(即元素排列次序与原次序相反)。步骤3) 再数组元素整体逆转。提示,任一数组元素a[i]经算法处理后,其

2017-10-21 14:04:42 938

原创 二叉树求叶子数、树的高度

#include#include#include#includeusing namespace std;#define status inttypedef struct bitnode{ char data; struct bitnode *lchild; struct bitnode *rchild;} bitnode,*sq;int r=0;bitnode *q;i

2017-10-16 14:06:07 410

原创 二叉树非递归层次遍历

#include#include#include#includeusing namespace std;#define status inttypedef struct node{ int data; struct node *next; struct node *lchild; struct node *rchild; struct node *front; struc

2017-10-16 09:32:36 248

原创 二叉树非递归遍历之中序遍历

#include#include#include#includeusing namespace std;#define status inttypedef struct bitnode{ char data; struct bitnode *next; struct bitnode *lchild; struct bitnode *rchild;}linkstack,*sq

2017-10-14 20:01:35 155

原创 二叉树递归的创建及三种遍历(先序、中序、后序)

#include#include#include#includeusing namespace std;#define status inttypedef struct bitnode {int data;struct bitnode *lchild;struct bitnode *rchild;} bitnode,*sq;int r=0;bit

2017-10-13 19:12:54 559

原创 快速幂模板

#include #include using namespace std;int power2(int a, int b, int c){    int res = 1;    a %= c;    while (b)    {        if (b%2==1)            res = (res * a) % c;        a =

2017-10-13 15:32:17 154

空空如也

空空如也

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

TA关注的人

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