代码和解释:
#include "stdafx.h"
#include
#include
#include
using namespace std;
class test{
int *p;
public:
test(int value){
p = new int(value);
cout>"<<endl;
cout<<"p的地址为"<<&p<<";p的值为"<<p <<" ...
分类:
编程语言 时间:
2014-09-03 22:46:37
阅读次数:
203
中文题,题意一看就是卧槽,这不约瑟夫么,然后脑子一抽就用了链表写,然后果然T了,最后用Vector模拟的约瑟夫问题。
#include
#include
#include
#include
#include
#include
#include
#include
#define LL __int64
using namespace std;
int n,m;
vectorp;
in...
分类:
其他好文 时间:
2014-09-03 22:43:57
阅读次数:
227
1 //Accepted 1240 KB 250 ms 2 //水题 欧拉回路 3 //连通+节点度均为偶数 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 const int imax_...
分类:
其他好文 时间:
2014-09-03 22:30:27
阅读次数:
187
所有房子组成一颗树,求出离根节点0的距离大于d的节点数目
DFS+vector存边 水过
#include "stdio.h"
#include "string.h"
#include "vector"
using namespace std;
vectormapp[100010];
int ans,d;
void dfs(int cur,int pre,int op)
{
...
分类:
其他好文 时间:
2014-09-03 21:21:39
阅读次数:
344
再不能直视这道题,换INT64就过了。。。。。。。同样可以使用矩阵的方法。构造1*5的D[N],a[n],b[n],a【n】*b[n],1接着你应该就会了。#include #include #include #define LL __int64using namespace std;const L...
分类:
其他好文 时间:
2014-09-03 21:16:47
阅读次数:
230
C语言中,数组名作为参数传递给函数时,退化为指针,sizeof对指针操作结果应该是4。例子如下:#includeusing namespace std;void Swap_arr(char* charArr){ int len = sizeof(charArr); cout usin...
分类:
编程语言 时间:
2014-09-03 21:01:47
阅读次数:
197
题目地址:UVa 120
水题。从最大的开始移,每次都把大的先翻到最上面,再翻到下面。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int a[500], b[5...
分类:
其他好文 时间:
2014-09-03 19:54:27
阅读次数:
262
这题 我还没有解决如果 谁恰好看到这篇 有好的解决方案 不妨底下留言告诉我-----------------------我看到时间限制是 5500ms 总觉得肯定能过的 1 #include 2 #include 3 using namespace std; 4 5 const int siz...
分类:
其他好文 时间:
2014-09-03 19:49:57
阅读次数:
318
17.39#include#include#include#includeusing namespace std;int main(){ fstream inOut("copyOut",fstream::ate|fstream::in|fstream::out); if(!inOut) ...
分类:
其他好文 时间:
2014-09-03 19:38:37
阅读次数:
198
1006 等差数列题目描述Description给定n(1#include#include#includeusing namespace std;int main(){ int a[105]; int n,large; cin>>n; large=0; for (in...
分类:
其他好文 时间:
2014-09-03 19:34:27
阅读次数:
904