`
weimou66
  • 浏览: 1249442 次
文章分类
社区版块
存档分类
最新评论
文章列表
//样例可以过,就是老提示运行错误,估计是内存神马的搞错了 //用了C++ stl 的栈和字符串类型,第一次用。//感觉还挺好吧,可惜就是没AC,不过纪念下。。。 #include<cstdio> #include<cstdlib> #include<string> #include<cmath> #include<stack> #include<sstream&g ...
虽然STL的内存配置器在我们的实际应用中几乎不用涉及,但它却在STL的各种容器背后默默做了大量的工作,STL内存配置器为容器分配并管理内存。统一 的内存管理使得STL库的可用性、可移植行、以及效率都有了很大的提升,因此STL内存配置器是STL库中最重要的组成部分之一。 1、Constructor和Destroy 我们所习惯的C++内存空间分配动作如下: class Foo { ... }; Foo* pObj = new Foo; delete pObj; 其中new操作符的动作可以分为两部分:1. ...
Description On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a single stone. The purpose of the game is to lead the s ...
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 5000 typedef struct { int v, w; }node; node data[1000]; int step=0,vis[1000],cost[1000]; int a[2]={-1,1}; int N,V; int dfs(int v) { vis[v]=0; for(int i=0; i<2; i++) if(!vi ...
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> using namespace std; #define MAX 2*10^9 char a[MAX]; int change_int(char *a) { int i, m, t, k; t = strlen(a); m = 0; for(i=t-1; i>=0; i--) { k = (int)p ...
http://acm.nyist.net/JudgeOnline/problem.php?pid=303 文章来源oj 题目是河南省第四届大学生程序设计竞赛 #include <iostream> 03.#include <cstring> 04.using namespace std; 05.int main() 06.{ 07. int i,j,n,len,k,sum,m; 08. char
puts() 函数输出时会自动换行。。。。
原文地址:http://blog.csdn.net/netbios333/article/details/4264114 一、WHY——为什么会出现ASH和AWR? 1. 10g之前 用户的连接将产生会话,当前会话记录保存在v$session中;处于等待状态的会话会被复制一份放在v$session_wait中。当该连接断开后, ...
int main(int agrc, char *argv[]) { vector<int> v(10); for(int i=0; i<10; i++) { v[i] = i; } v.erase(v.begin()+2); vector<int>:: iterator it; for(it=v.begin(); it != v.end(); it++) cout<<*it<<" "; cout<<endl; v.erase(v.begin()+1, ...
http://zhidao.baidu.com/question/37376788 %n与其他格式说明符号不同。%n不向printf传递格式化信息,而是令printf把自己到该点已打出的字符总数放到相应变元指向的整形变量中。因此%n对于的变元必须是整形指针 上一篇:线段树 下一篇:刚学的一些C++ 的容器。。。。
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #define NOCOL -1 #define MULCOL -2 using namespace std; struct tree{ int l, r, col, mid; tree *lc, *rc; }; tree *root; int n, l, r, col, i; int color[8001], cnt[8001]; tree *in ...
Description The cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors on their quest to find the exit.One popular maze-walking strategy guarantees that the visitor wi ...
公司的机器E5800 2G内存,debian 5.0,用了一年了,但是最近发现启动程序异常缓慢,慢道有点接受不了了启动一个vim要1分钟左右 使用strace vim输出如下信息 zhangzhao-debian:~# strace vim execve("/usr/bin/vim", ["vim"], [/* 34 vars */]) = 0 brk(0) = 0x9221000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such ...
Description   给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行走过程中,不能转太多弯了,否则她会晕倒的。我们假定给定的两个位置都是空地,初始时,gloria所面向的方向未定,她可以选择4个方向的任何一个出发,而不算成一次转弯。gloria能从一个位置走到另外一个位置吗? Input ...
把问题简化一下: 在自然数,且所有的数不大于30000的范围内讨论一个问题:现在已知n条线段,把端点依次输入告诉你,然后有m个询问,每个询问输入一个点,要求这个点在多少条线段上出现过; 最基本的解法当然就是读一个点,就把所有线段比一下,看看在不在线段中; 每次询问都要把n条线段查一次,那么m次询问,就要运算m*n次,复杂度就是O(m*n) 这道题m和n都是30000,那么计算量达到了10^9;而计算机1秒的计算量大约是10^8的数量级,所以这种方法无论怎么优化都是超时 ----- 因为n条线段是固定的,所以某种程度上说每次都把n条线段查一遍有大量的重复和浪费; 线段树就是可以解决这 ...
Global site tag (gtag.js) - Google Analytics