快速幂水过,贴一下模版。const mo=100003;var
x,y,n,m:int64;function power(num,times:int64):int64; var temp:int64; begin if
times=1 then exit(num); temp:=power(num,...
分类:
其他好文 时间:
2014-06-02 13:29:03
阅读次数:
284
1. Install GNUstepsudo apt-get install gnustep
gnustep-devel2. Write hello world program, and save as hello.m#import int main
(int argc, const char * ...
分类:
其他好文 时间:
2014-06-02 12:49:08
阅读次数:
185
题目:给定一个数,,求它最少可以用多少个包含字符串"61"的数字来表示,并输出这些数。
分析:对于大于6161的任何一个整数,都有如下表示
对于小于1616的数,直接背包即可。
代码:
#include
#include
#include
using namespace std;
typedef long long LL;
const...
分类:
其他好文 时间:
2014-06-02 10:35:40
阅读次数:
223
const char*
pcr:pcr指向char型的const对象不能通过pcr改变其指向的对象值,因为其指向的对象是个const但pcr本身不是const可以赋予其他的地址char*
const pcr:pcr是指向char型的const指针,不能在赋予其他的包括本身的地址*pcr是char型的...
分类:
其他好文 时间:
2014-06-02 05:40:57
阅读次数:
179
问题:
在Sudoku
Solver 中说道,会有一些提示解,这里就是验证下给定的提示解是否合法,即已经填加的数是否满足要求的三个条件。
bool isValidSudoku(vector > &board) {
const int M = 9;//9 * 9
const int hash_len = 60;//'0' = 48 + 10
const char do...
分类:
其他好文 时间:
2014-06-02 02:31:45
阅读次数:
279
题意:有A,B两个人,n道题目,每题有对应的分数,B答对题目的概率是0.5,求A不输给B的概率不小于P要拿的最低分数
思路:DP,dp[i][j]来表示B答了前i题后分数为j的概率,,然后通过B的概率求A的最低分数#include
#include
#include
#include
using namespace std;
const int MAXN = 40010;
int a[...
分类:
其他好文 时间:
2014-06-02 02:25:20
阅读次数:
243
常量是一种标识符,它的值在运行期间恒定不变。C语言用 #define来定义常量(称为宏常量)。C++ 语言除了 #define外还可以用const来定义常量(称为const常量)。
一、为什么需要常量
如果不使用常量,直接在程序中填写数字或字符串,将会有什么麻烦?
(1).程序的可读性(可理解性)变差。程序员自己会忘记那些数字或字符串是什么意思,用户则更加不知它们从何处...
分类:
编程语言 时间:
2014-06-01 14:54:48
阅读次数:
394
??
Description
Given N numbers, X1,
X2, ... , XN, let us calculate the difference of every pair of numbers: ∣Xi
- Xj∣ (1 ≤ i
< j ≤ N). We can get C(N,2) differences through this work, and no...
分类:
其他好文 时间:
2014-06-01 14:07:56
阅读次数:
347
class Abstract_base{public: virtual
~Abstract_base()=0;//有问题,链接不通过,不能是纯虚函数 virtual void interface() const
=0;//如果改到类的成员变量,最好不要设置为const //下面函数很糟糕,因为是vi...
分类:
其他好文 时间:
2014-06-01 12:11:01
阅读次数:
177
情况一:非静态成员函数C++的设计准则就是非静态成员函数至少和一般的非静态函数有相同的效率,因此非静态成员函数会被改写:举个例子:float
Point3d::magnitude3d()const {return x;}①改写函数原型,添加一个额外的参数this到member
function中,用...
分类:
其他好文 时间:
2014-06-01 11:44:45
阅读次数:
214