1 #include 2 #include 3 using namespace std; 4 bool isPrime(long n){ 5 int i; 6 for(i=2;i1&&i>sqrt(n))10 return true;11 else12 ...
分类:
其他好文 时间:
2014-07-07 09:54:37
阅读次数:
221
游戏没有计时,不是坑爹吗?这一期,我们将来加入游戏计时功能。1. 定义变量和函数我们先在HelloWorldScene.h中定义几个变量和函数 long startTime; bool timeRunning;startTime用来记录開始的时间,timeRunning用来推断游戏是否在进行中。 /...
分类:
其他好文 时间:
2014-07-07 09:16:24
阅读次数:
208
本文将讲述 CSS 中最核心的几个概念,包含:盒模型、position、float等。这些是 CSS 的基础,也是最经常使用的几个属性,它们之间看似独立却又相辅相成。为了掌握它们,有必要写出来探讨一下,如有错误欢迎指正。 元素类型HTML 的元素能够分为两种:块级元素(block level el....
分类:
Web程序 时间:
2014-07-03 22:14:13
阅读次数:
232
div 画糖葫芦效果:关键的属性:position:absolute; 1 2 3 4
分类:
Web程序 时间:
2014-07-03 22:09:03
阅读次数:
241
bootsect部分已经执行完成,程序也跳转到setup部分:
start:
! ok, the read went well so we get current cursor position and save it for
! posterity.
mov ax,#INITSEG ! this is done in bootsect already, but...
mov...
分类:
系统相关 时间:
2014-07-03 18:38:19
阅读次数:
329
题目链接:uva 756 - Biorhythms
题目大意:三个周期,23,28,33,输入为分别为在新一年中(三个周期均从0开始),出现周期中峰值的一天,以及当前的日子,问说需要经过多少天,才能使得三个峰值的在同一天。
解题思路:裸的中国剩余定理。
#include
#include
typedef long long ll;
const int maxn = 5;
con...
分类:
其他好文 时间:
2014-07-03 18:35:05
阅读次数:
204
题目链接:uva 10140 - Prime Distance
题目大意:给出一个范围,问说该范围内,相邻的两个素数最大距离和最小距离。
解题思路:类似素数筛选法,起始位置有L开始,直到超过R,处理出素数之后就好办了。
#include
#include
#include
const int maxn = 1e6;
typedef long long ll;
int cp,...
分类:
其他好文 时间:
2014-07-03 16:00:49
阅读次数:
213
文件读写、游标
seekg
函数原型:
istream &seekg( off_type offset, ios::seekdir origin );
istream &seekg( pos_type position );
函数seekg()用于输入流,并且它将重新设置"get"指针到当前流的从origin偏移offset个字节的位置上,或是置"get"指针在posit...
分类:
其他好文 时间:
2014-07-03 15:57:31
阅读次数:
225
选择排序
定义:依次选择最小的元素放在相应的位置上
特点:比较次数是 N(N-1)/2 交换次数是 N (each exchange puts an item into its ?nal position, so the number of exchanges is N. Thus, the running time is dominated by the number of
com...
分类:
其他好文 时间:
2014-07-03 15:44:01
阅读次数:
259
CD
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape N min...
分类:
其他好文 时间:
2014-07-03 15:34:36
阅读次数:
176