1.静态属性和静态方法静态方法的调用,ClassName::mothodName();class Pet{public: Pet(std::string theName); ~Pet(); static int getCount();//公开的静态方法protected: ...
分类:
编程语言 时间:
2014-07-09 14:24:19
阅读次数:
203
#include#include#includeusing namespace std;const int maxn=10010;vectorg[maxn];int Bcnt;int Top;int Index;int low[maxn],dfn[maxn];int belong[maxn],sta...
分类:
其他好文 时间:
2014-07-09 14:01:38
阅读次数:
163
1.构造器与结构体的区别:构造器多支持方法。其作用有申请内存,初始化变量。在c++中构造器没有返回值:语法Class Name();2.析构器的作用:释放内存。在c++中析构器没有返回值:语法~ClassName();class Animal{public: std::string mouth...
分类:
编程语言 时间:
2014-07-09 13:45:23
阅读次数:
207
时间限制:0.25s空间限制:4M题意: 在 n*n(n≤10)的棋盘上放 k (k#include #define LL long longusing namespace std;int powT[11];int statu[1 > 1) ) == 0) && ( (i & (i 0; t ...
分类:
其他好文 时间:
2014-07-09 13:43:57
阅读次数:
168
之前很傻,,感觉看不到拓扑是啥东西。。脑子太烂了吧。。。今晚上瞄了一眼就懂了。。我就放代码上来就行了。。注释也不打了,,因为太简单了。#include #include using namespace std;#define CC(i) memset(i, 0, sizeof(i))const in...
分类:
其他好文 时间:
2014-07-09 13:33:27
阅读次数:
235
假设一个球从任意高度自由落下,每次落地后反跳回原高度的一半; 再落下, 求它在第5次落地时,共经历多少米?第5次反弹多高?
输入起始高度,int型
分别输出第5次落地时,共经过多少米第5次反弹多高
【去掉小数末尾无效的0】
样例输入:1
样例输出:2.875
0.03125
#include
using namespace std;
d...
分类:
其他好文 时间:
2014-07-09 12:44:34
阅读次数:
344
题意:求从原点开始依次走1,2...n步后到回到原点的方案数,其中不能经过障碍,每次必须左右拐
思路:一个比较简单的DFS,结果做了好久#include
#include
#include
#include
using namespace std;
const int MAXN = 250;
const int Add = 100;
int n, ans;
int G[MAXN][M...
分类:
其他好文 时间:
2014-07-09 12:23:55
阅读次数:
421
题目连接:uva 12009 - Avaricious Maryanna
题目大意;给定n,求x,x为n位数,并且x*x的后n位还是x。
解题思路:打个表会发现其实有规律,除了n=1的时候多了0和1,其他都是n-1位的基础上再新增一位数,1位的时候是5,6.
#include
#include
#include
using namespace std;
const int m...
分类:
其他好文 时间:
2014-07-09 11:11:09
阅读次数:
137
HDU 4849 Wow! Such City!
题目链接
题意:按照题目中的公式构造出临接矩阵后,求出1到2 - n最短路%M的最小值
思路:就根据题目中方法构造矩阵,然后写一个dijkstra,利用d数组取求答案即可
代码:
#include
#include
#include
#include
using namespace std;
const lo...
分类:
其他好文 时间:
2014-07-09 09:11:12
阅读次数:
199
题意:求经过所有的管道的最短路程,管道内的时间不算
思路:首先BFS处理出管道出口到其他管道入口的距离,然后在队友的指导下明白了状态转移
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 16;
const int INF = 0x3f3f3f3f;
struct N...
分类:
其他好文 时间:
2014-07-09 09:09:21
阅读次数:
208