每日一C排序之struct字节对齐方式
每天拾一个C语言贝壳,厚积薄发,积跬步以致千里。
今日贝壳:结构体struct是多个相互关联数据的集合,这些数据以整体形式存储在内存。
{CSDN:CODE:262415}
那么结构体A是否占1+4+2=7个字节的位置呢,7个似乎很合理,但事实上,为了兼容各种不同的硬件,结构体内存分配采用特...
分类:
其他 时间:
2014-03-29 05:52:41
收藏:
0 评论:
0 赞:
0 阅读:
425
一万多的代码,看着好乱,有点吓人,JAVA还没学会,不然就很短了
题意是给你一个母串一个子串,问你子串在母串中出现的次数,一个字母可以用多次,但是没找到一个 子串它的元素 下标组合必须不同
比如母串babgbag
子串bag,
你可以找到 五个,
rabbbit
rabbit
你可以找到三个
总是做算法,不如来个陶冶情操的文章一篇: http://www.sanwen...
分类:
其他 时间:
2014-03-29 02:40:59
收藏:
0 评论:
0 赞:
0 阅读:
476
题意:
给定n个串,找一个字符串u,设前缀为u的字符有v个,则权值为 u*v,求最大的权值
思路:把所有串插到字典树中,答案就是节点深度*该节点的覆盖数
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll int
struct node{
int pos, ...
分类:
其他 时间:
2014-03-29 04:03:12
收藏:
0 评论:
0 赞:
0 阅读:
393
如果您还没有使用过git,推荐到这里学习以下。
1.cd 到你的项目目录
cd /Mycode/android/demo
2.建立本地仓库(repository)
git init
3.连接到csdn code 远程服务器
git remote add origi...
分类:
其他 时间:
2014-03-29 05:17:28
收藏:
0 评论:
0 赞:
0 阅读:
456
main.c:实现串口简单的发送的功能
#include "s5pc100.h"
int main()
{
UART0.ULCON0 = 0x03;
UART0.UCON0 = 0x05;
UART0.UFCON0 = 0;
UART0.UMCON0 = 0;
UART0.UBRDIV0 = 35;
UART0.UDIVSLOT0 = 0x888;
UART0.UINTM0 ...
分类:
其他 时间:
2014-03-29 04:55:00
收藏:
0 评论:
0 赞:
0 阅读:
304
Problem Description
假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值
Input
输入首先是一个整数N,代表测试实例的个数。
然后包括N行数据,每行包括26个
Output
对于每...
分类:
其他 时间:
2014-03-29 05:56:54
收藏:
0 评论:
0 赞:
0 阅读:
226
树的直径。。。。
Park Visit
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2225 Accepted Submission(s): 982
Problem Description
Cl...
分类:
其他 时间:
2014-03-29 02:31:20
收藏:
0 评论:
0 赞:
0 阅读:
517
题目
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
分析
确定中序遍历中根节点位置,递归构造左右子树
代码
public class Const...
分类:
其他 时间:
2014-03-29 02:37:32
收藏:
0 评论:
0 赞:
0 阅读:
415
4.为自定义控件添加事件
原文请看:http://clzf.co/blog.php?id=4
上一篇里面介绍了属性 这一篇来介绍一下事件
在这里强调一点 一提到事件 估计你脑子的反映就是控件的那些事件 比如鼠标点击事件 键盘事件什么的 确实 不过在C#中 事件绝对不是只有控件才有的东西 你普通的一个类也可以有事件 对于一些才开始接触C#的人可能有点犯晕了 对于C#中委托和事件 我这里找了...
分类:
其他 时间:
2014-03-29 05:41:38
收藏:
0 评论:
0 赞:
0 阅读:
613
目录
1 dtaudio介绍
2 audio decoder接口说明
3 audio decoder添加步骤
本篇文章主要介绍如何在dtaudio的模块中添加一个decoder。 之前我们添加了file stream 以及 aac demuxer。
本次添加一个aac 的decoder,利用第三方库faad2 来解码aac
这样用户就可以体验一下...
分类:
其他 时间:
2014-03-29 05:16:50
收藏:
0 评论:
0 赞:
0 阅读:
567
题目
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1...
分类:
其他 时间:
2014-03-29 03:51:33
收藏:
0 评论:
0 赞:
0 阅读:
310
题意:单点更新,区间查询
树状数组裸题:
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll int
#define N 200010
int tree[N], maxn;
int lowbit(int x){return x&(-x);}
int sum(in...
分类:
其他 时间:
2014-03-29 02:40:15
收藏:
0 评论:
0 赞:
0 阅读:
434
ACM DFS 搜索 Sum It Up hdu1258...
分类:
其他 时间:
2014-03-29 05:52:00
收藏:
0 评论:
0 赞:
0 阅读:
439
题目:
Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For...
分类:
其他 时间:
2014-03-29 04:13:18
收藏:
0 评论:
0 赞:
0 阅读:
437
暴力枚举。。。
I-number
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2803 Accepted Submission(s): 1065
Problem Description
The...
分类:
其他 时间:
2014-03-29 05:28:23
收藏:
0 评论:
0 赞:
0 阅读:
475
Pat1079代码
题目描述:
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.
Starting from one roo...
分类:
其他 时间:
2014-03-29 04:57:08
收藏:
0 评论:
0 赞:
0 阅读:
475
Pat1080代码
题目描述:
It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program ...
分类:
其他 时间:
2014-03-29 05:04:03
收藏:
0 评论:
0 赞:
0 阅读:
435
SAX是一种基于事件驱动的编程方法,SAX解析器对不同类型的内容触发不同的事件。已注册的监听器会对这些事件进行相应。
XmlReader不是靠事件触发,而是依赖于开发人员通过指定的功能来精确定位目标;使用XmlReader的开发者通过游标在文档中移动,当目标内容被找到时会把游标停在相应的位置...
分类:
其他 时间:
2014-03-29 05:15:32
收藏:
0 评论:
0 赞:
0 阅读:
347
最近将自己的电脑装成ubuntu系统了,每次遇到问题都得网上找资料。不知道为什么,以前用过几个版本的ubuntu 虽然没用几天就换掉了,但是好像firefox的flash插件一直没解决,在线安装总是失败。想想我们换个系统如果在线视频看不了,游戏玩不了,甚至在线音乐也玩不了,那还玩毛。。。当然我们知道想这样的问题,肯定是有解决办法的,对于我这种菜鸟来说,最重要的使能不能坚持先来,通过网上的资料,来自...
分类:
其他 时间:
2014-03-29 03:00:34
收藏:
0 评论:
0 赞:
0 阅读:
446
#include "stdafx.h"
#include "iostream"
using namespace std;
int last_people(int n,int m)
{
int *p = new int[n];
for (int i = 0;i < n; i ++)//编号//
*(p+i) = i + 1;
int k = 0,out_of_line = 0;
int...
分类:
其他 时间:
2014-03-29 02:39:33
收藏:
0 评论:
0 赞:
0 阅读:
605