2012年3月25日

冒泡和快速排序

摘要: 也没专门去研究过排序。只是平常用过这两种和这两种的变形:冒泡和快速。收录一下用的时候直接Copy就OK。 public class Method { public static void QuickSort(List<int> arrays, int low, int high) { int i = low; int j = high; if (low < high) { int key = arrays[low]; ... 阅读全文

posted @ 2012-03-25 16:30 c语言源码 阅读(161) 评论(0) 推荐(0) 编辑

BOJ 385

摘要: Problem C. VaccineDescriptionOn Christmas Eve, 2029, the unidentified "Apocalypse Virus" spreads andplunges JA into a state of emergency in a chaos known as the "LostChristmas" incident. An international organization known as the GHQintervenes with martial law and restores order 阅读全文

posted @ 2012-03-25 13:30 c语言源码 阅读(271) 评论(0) 推荐(0) 编辑

poj 1845

摘要: 大致题意:求A^B的所有约数(即因子)之和,并对其取模 9901再输出。解题思路:要求有较强数学思维的题应用定理主要有三个:要求有较强数学思维的题应用定理主要有三个:(1) 整数的唯一分解定理:任意正整数都有且只有一种方式写出其素因子的乘积表达式。A=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn) 其中pi均为素数(2) 约数和公式:对于已经分解的整数A=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn)有A的所有因子之和为S = (1+p1+p1^2+p1^3+...p1^k1) * (1+p2+p2^2+p2^3+….p2^k2) * (1+ 阅读全文

posted @ 2012-03-25 11:51 c语言源码 阅读(146) 评论(0) 推荐(0) 编辑

导航