bool is_left( int n )//是否为左节点{ return n % 2 == 0;}bool is_right( int n )//是否为右节点{ return 0 != n && ! is_left( n );}int father( int n )//父亲节点{ if ( ...
分类:
其他好文 时间:
2014-07-29 13:42:48
阅读次数:
182
定义一个模板
比较大小的函数如果v1和v2相同返回0,v1小-1,v2小1
int compare(const string &v1, const string &v2)
{
if(v1v2) return 1;
return 0;
}
int compare(const double &v1, cons...
分类:
编程语言 时间:
2014-07-29 13:18:36
阅读次数:
311
#include
using namespace std;
string m[]={"vaporeon","jolteon","flareon","espeon","umbreon","leafeon","glaceon","sylveon"};
int len[]={8,7,7,6,7,7,7,7};
int main()
{
int n,ans;
char s[20];
...
分类:
其他好文 时间:
2014-07-29 13:09:27
阅读次数:
200
/*偶数求和
Problem Description
有一个长度为n(n
Input
输入数据有多组,每组占一行,包含两个正整数n和m,n和m的含义如上所述。
Output
对于每组输入数据,输出一个平均值序列,每组输出占一行。
Sample Input
3 2
4 2
Sample Output
3 6
3 7
*/
//注意:输出的格式 ,空...
分类:
其他好文 时间:
2014-07-29 13:08:16
阅读次数:
173
#include
using namespace std;
struct vote{
int x;
string s;
}v[20];
bool cmp(vote a,vote b)
{
return a.x>b.x;
}
int main()
{
int n,m;
string str;
scanf("%d%d",&n,&m);
for(i...
分类:
其他好文 时间:
2014-07-29 13:07:57
阅读次数:
170
题目链接:http://vjudge.net/problem/viewProblem.action?id=20432
题目大意:朋友的朋友是朋友,求人数最多的那帮家伙有多少人。
我刚开始真尝试了一遍的一步一步用数组模拟搜索,拼接······,果断超时了,下次不干那么无聊的事了,明明有好算法,干嘛还暴力呢?#include
int fa[30001],tot[30001];
int find(int u)
{
fa[u]==u?u:fa[u]=find(fa[u]);
return fa...
分类:
其他好文 时间:
2014-07-29 13:06:37
阅读次数:
227
长为H的格子里面放n个长为h的格子 最多会有n+1个空隙
要使每个空隙长度都小于h (H-h*n)/(n+1)
n>(H/h-1)/2
#include
int main()
{
int W,H,w,h;
while(scanf("%d%d%d%d",&W,&H,&w,&h)==4)
{
int x=(int)ceil((W*1.0/w-1)/2),y...
分类:
其他好文 时间:
2014-07-29 13:04:57
阅读次数:
215
C语言中参数的传递方式一般存在两种方式:一种是通过栈的形式传递,另一种是通过寄存器的方式传递的。这次,我们只是详细描述一下第一种参数传递方式,另外一种方式在这里不做详细介绍。
首先,我们看一下,下面一个简单的调用例程:
int Add (int a, int b, int c)
{
return a+b+c;
}
void main()
{
int x =0 , y = 1...
分类:
编程语言 时间:
2014-07-29 13:04:26
阅读次数:
215
※效果
※代码
/**
* 转换图片成圆形
*
* @param bitmap
* 传入Bitmap对象
* @return
*/
public Bitmap toRoundBitmap(Bitmap bitmap) {
int width = bitmap.getWidth();
int heigh...
分类:
其他好文 时间:
2014-07-29 12:57:56
阅读次数:
263
原来在linux/include/linux/syscalls.h 中定义了如下的宏:复制代码#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)#define SYSCALL_DEFINE2(name...
分类:
系统相关 时间:
2014-07-29 12:35:16
阅读次数:
284