上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 59 下一页
摘要: 用结构体数据的安全性得不到保证。 使用类对数据进行封装,只能通过函数修改类中的数据 (1)类的定义 private:定义私有成员,只能被类本身的成员函数和友元访问。派生类和其他类均不能访问。若数据没有指明类型,默认为私有。 public:定义公有成员,可被程序中任何代码访问。 protected:定 阅读全文
posted @ 2019-11-22 22:12 ANhour 阅读(505) 评论(0) 推荐(1)
摘要: (1)结构体定义节点 用结构体存每个链表每个节点存的数据和指向的下一个节点的地址。 (2)用结构体定义一个链表,存链表的头指针和长度。 (3)新增一个节点(尾插法),节点存的数据是dt (4)删除存的数据是num的节点 (5)找到存的数据是num的节点 (6)输出这个链表 (7)完整代码 阅读全文
posted @ 2019-11-21 20:21 ANhour 阅读(4473) 评论(0) 推荐(0)
摘要: 1、 【问题描述】自定义一个复数类型Complex,其中含有若干成员函数,使用该类可以完成复数的加法以及对复数的输出。请完成类定义,并编制主函数,说明Complex类对象,对定义的各成员函数进行调用。 class Complex { double real; //复数实部 double imag; 阅读全文
posted @ 2019-11-19 17:31 ANhour 阅读(854) 评论(0) 推荐(0)
摘要: A 母牛的故事 题目大意:第一年有一头母牛,每年年初母牛生小母牛,小母牛第四个年头可以开始生小牛。 问第n年有多少头牛。 题解: (1)列出前几项来找规律(2)第i年牛的数量=第i-1年牛的数量+(新出生的牛的数量=第i-3年牛的数量) 代码: B Cow Bowling 7 3 8 8 1 0 2 阅读全文
posted @ 2019-10-18 22:50 ANhour 阅读(177) 评论(0) 推荐(0)
摘要: 传送门 题目大意:升序输入十进制数 没有重复 分成两个非空集合 每个集合组成一个数(不能有前导零) 求两个数差的最小值。 题解:全排列...我数组从1开始怎么一直WA...还有这个输入值得学习。 代码: 阅读全文
posted @ 2019-10-11 21:57 ANhour 阅读(208) 评论(2) 推荐(1)
摘要: 没有正解 都是我的暴力 T1生活大爆炸版石头剪刀布 把得分要求存进C数组里 c[i][j]表示i对j的得分情况 #include<iostream> #include<cmath> #include<ctime> #include<cstdio> #include<cstring> #include 阅读全文
posted @ 2018-11-06 21:12 ANhour 阅读(234) 评论(1) 推荐(0)
摘要: 没有正解,都是我的暴力 T1神奇的幻方 模拟 #include<iostream> #include<cmath> #include<ctime> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #de 阅读全文
posted @ 2018-11-06 19:26 ANhour 阅读(281) 评论(0) 推荐(0)
摘要: 没有正解,都是我的暴力 T1玩具谜题 模拟 // luogu-judger-enable-o2 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define N 100005 using names 阅读全文
posted @ 2018-11-05 21:50 ANhour 阅读(217) 评论(0) 推荐(0)
摘要: 没有正解,都是我的暴力 T1 枚举两个金币个数 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; int a,b,ans; in 阅读全文
posted @ 2018-11-04 21:59 ANhour 阅读(252) 评论(0) 推荐(0)
摘要: 鉴于Noip初赛考到了卡特兰数.....整理一下。凑合着看。 一、介绍 卡特兰数是一种经典的组合数,经常出现在各种计算中,其前几项为: 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694 阅读全文
posted @ 2018-11-04 15:55 ANhour 阅读(345) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 59 下一页