using System;namespace text2{ class Program { static void Main(string[] args) { int @int = 300; // 数据类型名 ...
分类:
其他好文 时间:
2015-07-30 22:51:51
阅读次数:
120
称号Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解答首先要注意空链表不成环;不能开额外的空间,即空间复杂度是o(1),可採用“快...
分类:
其他好文 时间:
2015-07-30 22:50:08
阅读次数:
106
Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o...
分类:
其他好文 时间:
2015-07-30 22:43:42
阅读次数:
113
#include
using namespace std;
#define Default -1
struct Node
{
int data;
Node *next;
Node *other;//这是复杂链表的额外的一个指针,指向一个指定位置的节点。
Node(int d = int()) :data(d), next(NULL), other...
分类:
编程语言 时间:
2015-07-30 21:33:46
阅读次数:
204
#include
#include
using namespace std;
int main()
{
int a[30005],i,j,n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
priority_queue , less > p; //大的先
priority_queue , greater >q;//...
分类:
其他好文 时间:
2015-07-30 21:30:59
阅读次数:
100
#include
#include
using namespace std;
class base
{
public:
virtual void funcA()
{
cout
}
};
class derived :public base
{
public:
virtual void funcB()
{
cout
}
};
void funcC(base...
分类:
编程语言 时间:
2015-07-30 21:30:47
阅读次数:
185
//a[i][j] 表示花j天做第i件事得到的收获
//m天时间得到的最大收获
#include
#include
#include
using namespace std ;
const int maxn = 110 ;
int dp[maxn] ;
int a[maxn][maxn] ;
int main()
{
int n , m...
分类:
其他好文 时间:
2015-07-30 21:26:01
阅读次数:
119
循环次数Description 我们知道,在编程中,我们时常需要考虑到时间复杂度,特别是对于循环的部分。例如, 如果代码中出现 for(i=1;i 2 #include 3 using namespace std; 4 5 int T[10000],m[2000],n[2000]; 6 int a....
分类:
其他好文 时间:
2015-07-30 21:18:43
阅读次数:
111
Description 给你一个高为n ,宽为m列的网格,计算出这个网格中有多少个矩形,下图为高为2,宽为4的网格. Input 第一行输入一个t, 表示有t组数据,然后每行输入n,m,分别表示网格的高和宽 ( n using namespace std;...
分类:
其他好文 时间:
2015-07-30 21:10:51
阅读次数:
110
等差和等比各扫一遍即可。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int N = 1000000; 9 const double eps = 1e-8;...
分类:
其他好文 时间:
2015-07-30 21:06:40
阅读次数:
116