http://blog.sina.com.cn/s/blog_590be5290100izdf.html用法:#include int getitimer(int which, struct itimerval *value);int setitimer(int which, const struc...
分类:
系统相关 时间:
2014-07-02 17:56:16
阅读次数:
260
题目链接:uva 11728 - Alternate
Task
题目大意:给出S,求N,要求N所有的因子和为S。
解题思路:枚举因子i,所有整除i的数和加上i。
#include
#include
const int N = 1005;
int n, c[N], v[N];
void init () {
memset(c, 0, sizeof(c));
...
分类:
其他好文 时间:
2014-07-02 16:55:04
阅读次数:
167
题目链接:uva 10515 - Powers Et Al.
题目大意:给出m和n,问说mn的个数上的数是多少。
解题思路:其实只要看m的最后一位数就可以了,判断最有一位的周期,然后用n%t即可。
#include
#include
#include
using namespace std;
const int maxn = 15;
const int maxs = 105...
分类:
其他好文 时间:
2014-07-02 16:25:50
阅读次数:
208
去除CDockablePane的隐藏、关闭、拖动、浮动风格在头文件里重载virtual BOOL CanBeClosed() const { return FALSE; }virtual BOOL CanAutoHide() const { return FALSE; }virtual BOOL F...
分类:
其他好文 时间:
2014-07-02 13:53:59
阅读次数:
426
题目:
通过键盘输入100以内正整数的加、减运算式,请编写一个程序输出运算结果字符串。
输入字符串的格式为:“操作数1 运算符 操作数2”,“操作数”与“运算符”之间以一个空格隔开。
补充说明:
1、操作数为正整数,不需要考虑计算结果溢出的情况。
2、若输入算式格式错误,输出结果为“0”。
要求实现函数:
void arithmetic(const char *pInputS...
分类:
其他好文 时间:
2014-07-02 11:22:01
阅读次数:
265
(一)归并排序
分析:
(1)划分问题:把序列分成元素个数尽量相等的两半。
(2)递归求解:把两半元素分别排序。
(3)合并问题:把两个有序表合并成一个。(每次只需要把两个序列的最小元素加以比较,删除其中的较小元素并加入合并后的新表)
#include
using namespace std;
const int MAXN = 1000;
int A[MAXN], T[MAXN];
...
分类:
其他好文 时间:
2014-07-02 09:22:26
阅读次数:
243
题目,求一个连续的数组,最大连续和。
(一)O(n3)算法:
利用穷举法的思想,这种方法的效率最差。
代码如下:
#include
#include
#include
#include
using namespace std;
const int MAXN = 1000;
int A[MAXN], n;
int maxsum(int *A, int n) {
int beat...
分类:
其他好文 时间:
2014-07-02 09:15:50
阅读次数:
349
有许多时候,我们自己编写类的operator=函数(例如,当类中包含指针时)。
考虑如下的一个类:
class Widget {
public:
Widget(int x=0): val(new int(x)) {}
~Widget() { delete val; }
Widget(const Widget &rhs): val(new int(*rhs.val)) {}
//...
分类:
其他好文 时间:
2014-07-02 09:08:20
阅读次数:
188
二分+SPFA找负环
11090 - Going in Cycle!!
Time limit: 3.000 seconds
#include
#include
#include
#include
#include
using namespace std;
const double INF=1000000000.;
struc...
分类:
其他好文 时间:
2014-07-02 08:30:41
阅读次数:
216
给某个菜单项添加一个事件处理程序:
1. void CMainFrame::OnTest()
2. {
3. MessageBox("you clicked Menu item.");
4. // TODO: 在此添加命令处理程序代码
5. }
编译时报告如下错误:e...
分类:
其他好文 时间:
2014-07-02 08:28:40
阅读次数:
222