1 using System; 2 using
System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using
System.Threading.Tasks; 6 7 namespace 冒泡排序法 8 .....
分类:
其他好文 时间:
2014-06-10 12:55:13
阅读次数:
165
利用扩展方法,实现参数验证。 1 using System; 2 using
System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using
System.Threading.Tasks; 6 7 name....
分类:
其他好文 时间:
2014-06-10 12:53:48
阅读次数:
141
水题,注意数据范围#include using namespace std;int main(){
long long n,a; cin >> n; long long sum =(n*(n+1))>>1; for(int i = 0
; i >a; sum ...
分类:
其他好文 时间:
2014-06-10 12:47:58
阅读次数:
233
水题,只要遍历一遍,不够平均数的,从后面的借,比平均数多的,把多余的数添加到后面即可,注意数据范围#include
#include #include using namespace std;int main(){ int n; cin >> n; vector
a(n); ...
分类:
其他好文 时间:
2014-06-10 12:42:12
阅读次数:
176
---恢复内容开始---这道题就是明显的完全背包题啦,只不过物品的重量和价值是一样的。我就是按照《背包九讲》中完全背包的思路,先把物品的数量
ni 按照1,2,4,8...的规律分解,然后直接用简单背包暴力数据比较小,10种物品,每一种最多1000个,cash 2 #include 3 using
...
分类:
其他好文 时间:
2014-06-10 12:31:52
阅读次数:
182
Sort a linked list using insertion sort. 1 /**
2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *
ListNode *nex...
分类:
其他好文 时间:
2014-06-10 12:14:19
阅读次数:
253
using System;using System.Collections.Generic;using
System.Text;using System.Data;using System.Data.SqlClient;namespace DAL{/// ///
数据层 - 数据库 操作类/// i...
分类:
数据库 时间:
2014-06-10 12:12:58
阅读次数:
307
队列常常也使用链式存储的方式来实现。为了方便操作,同顺序存储一样,我们要维护一个头指针和一个尾指针。如下图:
在链式队列中显然不会出现假溢出的情况。但在出队时,要及时释放内存。由于在队列的实现:顺序队列中,对队列的描述已经很清楚了。就闲话不多说,直接上代码:
类定义和类实现
#include
#include
using namespace std;
typedef int ELem...
分类:
其他好文 时间:
2014-06-10 08:04:30
阅读次数:
253
程序代码(这段代码在vc6.0中不能编译通过,在VS中能编译通过)
#include
using namespace std;
template//类声明前加模板的声明
class Complex
{
public:
Complex( )
{
real=0;
imag=0;
}
...
分类:
其他好文 时间:
2014-06-10 08:02:29
阅读次数:
249
setw()称为操纵程序(manipulator),它允许操纵或控制输出的外观。操纵程序不输出任何内容,只是修改输出过程。它的作用是把下一个要输出的值的字段宽度设置为括号中指定的字符数,使用setw()设置的字段宽度只应用于下一个写入cout的值。后续的值会以默认格式显示。setw()包含在头文件里,小示例如下:
#include
#include
using std::cout;
u...
分类:
编程语言 时间:
2014-06-10 07:32:19
阅读次数:
208