fuerbosi
fuerbosi · 共 678 篇文章
暑假c++复习8
set类头型(头文件set) set只是单纯的键集合;支持大部分的map的操作,包括:insert,count,find,以及erase; set 不支持下标操作符,而且value_type不是pair类型而是key_type类型。这一差别体现了set存储的元素仅仅是键而没有所关联的值,和map一样,键值是唯一的。而且不能修改。 vector<int>ivec; for(vector<int>::size_type i=0;i!=10;++) { ivec.push_back(i); ivec.push_back(i); } set<int>iset(ivec.begin(),ivec.en…
2012-07-12 18:22 · 评论(0)
修改activity 的显示样式 在AndroidMainifest.xml
<!--QQ表情--> <activity android:name=".pub.ui.FaceDialogActivity" android:theme="@android:style/Theme.Dialog" android:screenOrientation="portrait" />
2012-07-12 18:21 · 评论(0)
Android中Bitmap及Drawable转换
1.Drawable—>Bitmap Resources res=getResources(); Bitmap bmp=BitmapFactory.decodeResource(res, R.drawable.sample_0); 2.Bitmap---->Drawable Drawable drawable =new BitmapDrawable(bmp); 另外在网上搜了些,也不知到底谁是原创的,反正不是我 1、Drawable → Bitmap public static Bitmap drawableToBitmap(Drawable drawable) { Bitmap bitma…
2012-07-12 17:50 · 评论(0)
堆排序
#include<iostream> #define LEFT(i) (i<<2) #define RIGHT(i) ((i<<2)+1) using namespace std; void swap(int& small, int& big) { int temp = small; small = big; big = temp; } /* |把父节点和两个儿子节点做比较,把最大数的下标值存入largest |当父节点arr[root]比arr[leftchild]和ar[rightchild]时, |函数heap_adjust退出。下一次找最大数就是从左儿子节点开始的, |依次往下,比较…
2012-07-12 17:40 · 评论(0)
POJ-3984-迷宫问题
POJ-3984-迷宫问题 http://poj.org/problem?id=3984 用BFS求最短路劲,记录每一个状态之前的状态,输出路劲即可 #include<stdio.h> #include<string.h> #include<stdlib.h> int map[5][5]; int visit[5][5]; int pre[100]; //记录每一个状态的前一个状态 struct cam { int x; int y; }list[100]; int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}}; int go(int x,int y) { if…
2012-07-12 17:10 · 评论(0)
创建最大堆
首先来观察一颗最大堆二叉树 和一个普通序列的映射情况:在序列中从length(LIST)/2+1 -> length(LIST)的元素都对应于二叉树的叶子节点,同时也是一颗独立的树,且最大数就是自己本身。 #include<iostream> #define LEFT(i) (i<<2) #define RIGHT(i) ((i<<2)+1) using namespace std; void swap(int& small, int& big) { int temp = small; small = big; big = temp; } void heap_adjust(int arr[]…
2012-07-12 16:56 · 评论(0)
Flex 日期计算用法举例
最近flex项目中用到了关于日期时间的计算,也从网上找了些资料。自己整理了一下,方便以后查询 1.计算一个月的最后一天: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="application1_i…
2012-07-12 15:54 · 评论(1)
Spring AOP 用法初探
以下从E文中摘得: Common AspectJ annotations : @Before – Run before the method execution @After – Run after the method returned a result @AfterReturning – Run after the method returned a result, intercept the returned result as well. @AfterThrowing – Run after the method throws an exception @Around – Run a…
2012-07-12 15:13 · 评论(0)
暑假c++复习7之关联容器
关联容器的类型: map:关联数组;元素通过键来从存储读取 set:大小可变的集合,至此后通过建实现快速读取 multimap:支持同一个键多次出现的map类型 multiset:支持同一个键多次出现的set类型 一般来说,如果希望有效地存储不同值的集合,那么使用set比较合适,而map容器则更适用于需要存储乃至修改每个键所干练的值的情况。在做某种文本处理时,可使用set保存要忽略的单词。而字典是map的一种很好的应用,单词本身是键而他的解释说明则是值, 在开始介绍关联容器之前必须先了解一种鱼值相关的简单的标准库类型--pair类型;该类型在utility中定义。 pair的基本操作; pa…
2012-07-12 14:37 · 评论(0)
NSRunLoop Internals
原文在这里: http://www.mikeash.com/pyblog/friday-qa-2010-01-01-nsrunloop-internals.html If you want to understand something as thoroughly as possible, you should build one yourself. That's a little too much for a blog post, so rather than build a complete implementation of NSRunLoop , I'm going to take …
2012-07-12 09:33 · 评论(0)
c#中程序最小化到托盘
拖一个 notifyIcon控件到界面,名为 notifyIcon1 //窗体对应的事件 #region Form1_SizeChanged private void Form1_SizeChanged(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) //判断是否最小化 { this.ShowInTaskbar = false; //不显示在系统任务栏 notifyIcon1.Visible = true; //托盘图标可见 this.notifyIcon1.ShowBalloo…
2012-07-12 08:38 · 评论(0)
学习一下让程序只运行一个实例的方法
让程序只运行一个实例的方法一: static void Main() { System.Threading.Mutex mutex; bool isNew; mutex = new System.Threading.Mutex(true, "myproject", out isNew); if (isNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Login()); } else { MessageBox.Sho…
2012-07-12 08:21 · 评论(0)
向深海微生物学习,提高太阳能转换效率
<style type="text/css"> <!-- @page {margin:2cm} p {margin-bottom:0.21cm} --> </style> 说句实在话,纳米科学家都是“杂家”,数理化,天地生,无所不晓,无所不能。现在的问题是,对于这批“怪人”,应该由谁来养活他们? 7月6日,在美国《MIT News》上发表一篇新闻报道,题为“Researchers explain how dye-based nanotubes can help harvest light’s energy”,意思是,基于染色的纳米管如何帮助人们收集太阳能。副标题是:“Tiny cylinde…
2012-07-12 05:44 · 评论(0)
uva 10596 - Morning Walk
点击打开链接 题目意思:给定n个点,判断由某一点出发最后能否回到原点 解题思路:比较简单的欧拉回路的应用,根据欧拉回路的性质,所有节点的度数(入度加出度)都是偶数,我么只须要开一个road数组存储每一个节点的度数,最后遍历数组判断是不是全部都是偶数即可 代码: //简单的欧拉回路的应用 #include <iostream> #include <cstdio> #include <cstring> #include <queue> using namespace std; const int MAXN = 210; int n , r; int road[MAXN];//存储节点的度数 in…
2012-07-12 00:23 · 评论(0)
uva 10129 - Play on Words
点击打开链接 题目意思:给定n个单词,要求单词的第一个字母和前一个单词的最后字母相同(除了第一个),判断所有单词是否可以连成一条链。 解题思路:题目很明显是一个有关欧拉路的问题,我们先了解一下有关欧拉道路和欧拉回路的区别。欧拉道路是分为有向和无向两种,对于欧拉道路上的节点有两种度,入度和出度,入度表示进入该节点次数,出度表示出去该节点的次数,对于一条普通的有向欧拉道路来说存在一个起点和终点,并且起点的入度比出度小1,终点的入度比出度大1,下面介绍特殊的欧拉道路-----欧拉回路,欧拉回路是起点和终点重合,并且所有的节点的度都相同都为偶数。 有了这些知识,介绍解题方法,首先我们用两个数组in …
2012-07-12 00:13 · 评论(0)