阅读程序:
#include
using namespace std;
class Time
{
public:
Time(int h,int m,int s):hour(h),minute(m),sec(s) {}
void display1(); //display1是成员函数
friend void display2(Time &); //d...
分类:
其他好文 时间:
2015-04-15 19:45:45
阅读次数:
164
思路很好像,卡了我很久的就是当最大房间一样的时候判断输出哪个的条件, = = 简直无情
/*
ID: 18906421
LANG: C++
PROG: castle
*/
#include
#include
#include
using namespace std;
const int maxn = 55;
int mat[maxn][maxn][2] = {0}; // 0 1 下 右
i...
分类:
其他好文 时间:
2015-04-15 19:40:26
阅读次数:
150
#include
#include
#include
#include
#include
using namespace std;
#define maxn 10000
#define eps 1e-8
struct
{
int w, v;
}a[maxn];
double b[maxn];
int n, k;
bool cmp(double a, double b)
...
分类:
其他好文 时间:
2015-04-15 19:39:16
阅读次数:
122
题目大意:找到队列中不符合非升(降)序趋势的编号个数,分别判断升序跟降序的个数,最后取最小。#include
#include
#include
#include
using namespace std;#define maxn 30005int n;
int cow[maxn];
int f[maxn][5];int...
分类:
其他好文 时间:
2015-04-15 19:37:54
阅读次数:
131
在“吃豆子”游戏中,计划将有3种不同类型的敌人。
· 松散型:在碰到墙壁后才会回头
· 守卫型:当敌人和主人公“大嘴”处在同一行或者是同一列后才会引起警觉接近大嘴。
· 扰乱性:不断的接近大嘴。
这三种敌人分别用以下的函数实现:
//AI人工智能处理
void RedOne::MakeDecision(bool b)
{
int i = rand();
if (b)//碰到墙壁,改变...
分类:
其他好文 时间:
2015-04-15 19:35:53
阅读次数:
136
1 #include 2 int fib(int n) 3 { 4 int a=1,b=1,c; 5 if(n==1||n==2) return 1; 6 n-=2; 7 while(n--) 8 { 9 c=a+b;10 a...
分类:
其他好文 时间:
2015-04-15 19:30:49
阅读次数:
98
发票的额度是小数,但是只要求精确到两位,所以我们把初始数据乘以100进行处理。这道题我比较纠结的是dp的数组到底开多大...开大了内存超限,小了数组越界。#include#includeint val[50];//记录符合报销条件的发票的额度。(乘以100以后)int tmp[26];//临时记录发...
分类:
其他好文 时间:
2015-04-15 19:18:22
阅读次数:
123
第一个const 函数的返回值类型是const。 这个const修饰没什么意义,你可以想象一下: 既然是函数的 返回值,而且是值传递的形式,是否const有什么意义。如果指针(引用)传递,怎表示返回值的内容不可修改:一般用在赋值操作中,例: const A& operator =() { ... ....
分类:
其他好文 时间:
2015-04-15 19:10:14
阅读次数:
124
mysql将时间戳转成常用时间格式 在mysql中,一个时间字段的存储类型是int(11),怎么转化成字符类型,比方存储为13270655222,需要转化为yyyy -mm-dd的形式。使用 FROM_UNIXTIME函数,具体如下: FROM_UNIXTIME(unix_timestamp,for...
分类:
数据库 时间:
2015-04-15 19:08:52
阅读次数:
140
static void Main(string[] args) { ArrayList al = new ArrayList();//集合里面所有类型都可以放入 Console.Write("请输入人数:"); int n = Convert.ToInt32(Console.ReadLine());...
分类:
其他好文 时间:
2015-04-15 19:08:41
阅读次数:
116