- 博客(54)
- 收藏
- 关注
原创 BaseExpandableListAdapter
BaseExpandableListAdapter:支持动态加载layout-item_child:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50d...
2018-03-29 15:28:10 471
原创 SimpleExpandableListAdapter
SimpleExpandableListAdapter用于展开列表,比如QQ好友列表layout-activity_main: <ExpandableListView android:id="@+id/my_elv" android:layout_width="match_parent" android:layout_height="ma...
2018-03-29 10:09:30 824
原创 GridView+BaseAdapter
GridView+BaseAdapter相比GridView+SimpleAdapter可以较为自由的设置图片和文字layout-grid_item:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" a...
2018-03-28 15:32:28 563
原创 GridView+SimpleAdapter
layout-activity_main: <GridView android:id="@+id/my_gv" android:layout_width="match_parent" android:layout_height="match_parent" android:numColumns="3">3列 ...
2018-03-28 14:17:45 255
原创 BaseAdapter
相比于SimpleAdapter,不仅可以显示数据,还可以根据数据设定不同的逻辑。layout-item_info:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_hei...
2018-03-28 10:38:46 105
原创 SimpleAdapter
layout-item_info:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientatio...
2018-03-28 09:26:41 135
原创 python 统计字符串中的字符个数
题目内容:定义函数countchar()按字母表顺序统计字符串中所有出现的字母的个数(允许输入大写字符,并且计数时不区分大小写)。形如:def countchar(str): ... ... return a listif __name__ == "__main__": str = input() ... ... print(countchar(str))...
2018-03-27 15:13:16 10973
原创 python zip函数
请写出如下命令的运算结果:(1, 2) in zip(range(4), range(2,6))应该是 False这里(0,2),(1,3),(2,4),(3,5)in zip(range(4), range(2,6)) 都为True(一一对应)>>> (0, 2) in zip(range(4), range(2,6))True>>> (2, 0) ...
2018-03-27 14:40:40 675
原创 1147. Heaps (30)
1147. Heaps (30)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueIn computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node...
2018-03-26 14:47:09 173
原创 1146. Topological Order (25)
1146. Topological Order (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order o...
2018-03-26 14:42:22 601
原创 Python本地数据获取
f.read(5):读5个字节,然后文件指针指向下一个,所以p2是 ,World!写完之后,文件指针会指向末尾,所以应该用seek(0)回到开头,然后再读
2018-03-26 12:00:43 231
原创 1145. Hashing - Average Search Time (25)
1145. Hashing - Average Search Time (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe task of this problem is simple: insert a sequence of distinct positive integers into a hash table ...
2018-03-25 14:49:28 264 1
原创 1144. The Missing Number (20)
1144. The Missing Number (20)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Spec...
2018-03-25 14:41:35 202
原创 ListView
ListView允许用户通过手指上下滑动的方式将屏幕外的数据滚动到屏幕内,比如查看QQ聊天记录,翻阅微博最新消息等。方法一:entriesres-values-arrays.xml:mac小技巧:把全部苹果改成香蕉,把光标放到苹果1的 苹 前面,按住option,就可以拖过鼠标拖动选中全部苹果 <resources> <string-array name="fruit"&...
2018-03-25 09:43:06 152
原创 Spinner
方法一:字符串数组res-values:<?xml version="1.0" encoding="utf-8"?><resources> <string-array name="fruit"> <item>苹果</item> <item>
2018-03-24 16:17:46 154
原创 ProgressBar
进度条显示用 Style 属性来给 ProgressBar 确定样式,使用系统的attr:style="?android:attr/progressBarStyleHorizontal" <ProgressBar android:id="@+id/my_pb" android:layout_width="match_parent" androi...
2018-03-24 11:14:23 136
原创 SeekBar
SeekBar的主要应用在音乐播放,视频播放,或者对音量调节,屏幕亮度调节的一些操作中,让用户可以手动的去改变相应的值。<SeekBar android:id="@+id/my_seekbar" android:layout_width="match_parent" android:layout_height="wrap_content" ...
2018-03-24 10:41:53 2722 1
原创 RadioButton
RadioButton是圆形单选框 2. RadioGroup是个可以容纳多个RadioButton的容器 3. 在RadioGroup中的RadioButton控件可以有多个,但同时有且仅有一个可以被选中<RadioGroup android:layout_width="wrap_content" android:layout_h...
2018-03-24 09:35:51 434
原创 蟒蛇代码分析
#PythonDraw.pyimport turtle #引入turtle库turtle.setup(650, 350, 200, 200) #宽650,高350,turtle.penup() #抬起画笔,之后移动画笔不绘制图形turtle.fd(-250) #后退250turtle.pendown() #落下画笔,之后移动画笔将绘制图形turtle.pensiz...
2018-03-22 10:31:58 3373 1
原创 python 寻找第n个默尼森数
寻找第n个默尼森数。代码格式如下:def prime(num): def monisen(no): … … return xxxprint(monisen(int(input()))) #此处不需要自己输入,只要写这样一条语句即可,主要完成monisen()函数(4分)经典程序设计问题:找第n个默尼森数。P是素数且M也是素数,并且满足等式M=2**P-1,则称M为...
2018-03-21 10:49:34 1104
原创 1143. Lowest Common Ancestor (30)
1143. Lowest Common Ancestor (30)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as ...
2018-03-19 07:54:12 535
原创 1142. Maximal Clique (25)
1142. Maximal Clique (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjac...
2018-03-19 07:47:25 269
原创 1141. PAT Ranking of Institutions (25)
1141. PAT Ranking of Institutions (25)时间限制500 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAfter each PAT, the PAT Center will announce the ranking of institutions based on their students' perfor...
2018-03-19 07:41:30 281
原创 1140. Look-and-say Sequence (20)
1140. Look-and-say Sequence (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueLook-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...wh...
2018-03-19 07:35:41 239
原创 第一周Python基本常识
这个Python中貌似没有实数...单独的下划线也能做变量,试了试C语言,居然也行..#include<stdio.h>int main(){ int _=4; printf("%d",_);//输出4 }
2018-03-14 20:59:10 139
原创 python3 round函数
开心,学Pyhton了~我这里是Python3,也许round函数和版本有关round看讨论区说是 四舍六入 0.5的话划分到最近偶数>>> round(4.5)4>>> round(5.5)6>>> round(3.50)4>>> round(5.50)6>>> round(4.50
2018-03-13 11:22:28 961
转载 大整数乘法
描述求两个不超过200位的非负整数的积。输入有两行,每行是一个不超过200位的非负整数,没有多余的前导0。输出一行,即相乘后的结果。结果里不能有多余的前导0,即如果结果是342,那么就不能输出为0342。样例输入12345678900 98765432100样例输出1219326311126352690000参考别人的:#include<stdlib.h> #include<...
2018-03-12 14:14:41 1625
转载 1103. Integer Factorization (30)
1103. Integer Factorization (30)时间限制1200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive intege...
2018-03-11 16:43:08 116
原创 1139. First Contact (30)
1139. First Contact (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueUnlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years....
2018-03-10 16:06:57 331
原创 1138. Postorder Traversal (25)
1138. Postorder Traversal (25)时间限制600 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traver...
2018-03-10 16:00:57 115
原创 1137. Final Grading (25)
1137. Final Grading (25)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueFor a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be ...
2018-03-09 15:59:16 136
原创 1136. A Delayed Palindrome (20)
1136. A Delayed Palindrome (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueConsider a positive integer N written in standard notation with k+1 digits ai as ak...a1a0 with 0 <= ai <...
2018-03-09 15:54:46 92
原创 1135. Is It A Red-Black Tree (30)
1135. Is It A Red-Black Tree (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThere is a kind of balanced binary search tree named red-black tree in the data structure. It has the followi...
2018-03-08 19:10:51 346
原创 1134. Vertex Cover (25)
1134. Vertex Cover (25)时间限制600 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of t...
2018-03-07 19:42:20 122
原创 1133. Splitting A Linked List (25)
1133. Splitting A Linked List (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a singly linked list, you are supposed to rearrange its elements so that all the negative values appea...
2018-03-07 14:25:50 65
原创 1132. Cut Integer (20)
1132. Cut Integer (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueCutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers A and B. For e...
2018-03-07 14:25:06 84
转载 1130. Infix Expression
1130. Infix Expression (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses refle...
2018-03-06 14:41:31 280
原创 memset按照字节赋值
memset按照字节赋值0 -1的二进制代码(补码)为 全0 和 全1所以最好使用fill对其他值赋初值#include<stdio.h>#include<math.h>#include<string.h>//memsetint main(){ int a[2]; memset(a,1,sizeof(a));//memset按照字节赋值 pr...
2018-03-05 20:23:00 315
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人