描述小南刚学了二进制,他想知道一个数的二进制表示中有多少个1,你能帮他写一个程序来完成这个任务吗?输入第一行输入一个整数N,表示测试数据的组数(1 2 3 int main(){ 4 int T; 5 int n; 6 int amount; 7 8 s...
分类:
其他好文 时间:
2014-11-14 17:32:16
阅读次数:
284
实现代码: 1 #include 2 #include 3 4 int heads() 5 { 6 return rand() coin.exe 32 1000 0 1 2 3 4 5 6 * 7 * 8 * 9 *10 **11 ****12 ******13 ********14 **...
分类:
编程语言 时间:
2014-11-14 17:31:33
阅读次数:
327
创建一个空洞文件#include #include #include int main(){ int fd=open("hole",O_WRONLY | O_CREAT,0666); write(fd,"1G hole are coming",strlen("1G hole are co...
分类:
其他好文 时间:
2014-11-14 17:28:11
阅读次数:
105
摘要: 介绍了事件委托机制的需求,各种解决方案的演变,最终提出模板化的事件委托机制,并给出较详细的进化过程和原理说明。关键词: C++,委托,委托器,事件器,模板第一章 基础版实现在平时的工作中,我们经常会遇到以下情况void Do(int event_id){ …}void OnEvent(int...
分类:
编程语言 时间:
2014-11-14 17:20:49
阅读次数:
324
描述输入两点坐标(X1,Y1),(X2,Y2)(0 2 #include 3 4 int main(){ 5 int T; 6 double a; 7 double b; 8 double c; 9 double d;10 double dist...
分类:
其他好文 时间:
2014-11-14 17:20:17
阅读次数:
202
描述兄弟俩骑车郊游,弟弟先出发,每分钟X米,M分钟后,哥哥带一条狗出发。以每分钟Y米的速度去追弟弟,而狗则以每分钟Z米的速度向弟弟跑去,追上弟弟后又立即返回,直到哥哥追上弟弟时,狗跑了多少米?输入第一行输入一个整数N,表示测试数据的组数(N 2 3 int main(){ 4 int T...
分类:
其他好文 时间:
2014-11-14 17:17:03
阅读次数:
110
类的基本语法:修饰词 class 类名{ 修饰词 类型 属性名;}实例:public class Book{ int id; String name; String[] authors ={"佚名"}; double price; String isbn;//书号}对...
分类:
编程语言 时间:
2014-11-14 17:16:41
阅读次数:
180
SimpleAdapter(Contextcontext,List> data, int resource,String[]from, int[] to)参数context:上下文,比如this。关联SimpleAdapter运行的视图上下文参数data:Map列表,列表要显示的数据,它是包含Map...
分类:
其他好文 时间:
2014-11-14 17:16:31
阅读次数:
113
获取文件属性(struct stat):int stat(const char* restrict pathname,struct stat* restrict buf);int fstat(int fd,struct stat* restrict buf);int lstat(const char...
分类:
其他好文 时间:
2014-11-14 17:15:34
阅读次数:
252
android AttributeSet API 之开发案例
在通过xml文件构造view组件的时候,往往都要使用到AttributeSet和defStyle这个两个参数。
public class myButton extends Button{
public myButton(Context context, AttributeSet attrs, int defStyle) {
s...
分类:
移动开发 时间:
2014-11-14 15:45:27
阅读次数:
206