码迷,mamicode.com
首页 > 其他好文
hdu5392--Infoplane in Tina Town(置换群+质因子分解求最小公倍数)
题目链接:点击打开链接 题目大意:给出一种操作a[1],a[2],,,,a[n],代表每交换一次,1位置的数到a[1]位置,2位置的数到a[2]位置,,, 问最终交换多少次可以恢复初始的情况。 题目给出一个置换,要求置换的次数,也就是所有轮换个数的最小公倍数。首先求出所有轮换的个数,然后求最小公倍数的时候不能用gcd,因为Mod的取余太大,所以用质因子分解,统计每个质因子出现的最多次数,计算...
分类:其他好文   时间:2015-08-17 17:28:59    阅读次数:125
将矩阵中0元素所对应的行列都清零
编写一个算法,若M*N矩阵中某个元素为0,则将其所在的行与列清零。 void setZeros(int **matrix, int lrow, int lcol) { bool *row = new bool[lrow]; bool *column = new bool[lcol]; //记录值为0的元素所在的行索引和列索引 for (int i = 0; i { ...
分类:其他好文   时间:2015-08-17 17:28:12    阅读次数:171
线段树专题—ZOJ1610 Count the Colors
题意:给一个n,代表n次操作,接下来每次操作表示把[l,r]区间的线段涂成k的颜色其中,l,r,k的范围都是0到8000 分析:其实就是拿线段树维护一段区间的颜色,总体用到的是线段树的区间更新把,但是会给人一种区间合并的错觉 注意:这题比较坑的是千万不能拿n建树,不然就会segmentation fault,必须拿8000建树,也就是树是固定的 代码: #inclu...
分类:其他好文   时间:2015-08-17 17:26:14    阅读次数:137
用GO按老大要求写了一个小工具,用他脚本下载日志文件,然后让开发自己去下载
package main import ( "archive/tar" "bufio" "bytes" "compress/gzip" "flag" "fmt" "io" "net/http" "os" "os/exec" "regexp" "sort" "text/template" "time" ) type ID_info map[string]string ...
分类:其他好文   时间:2015-08-17 17:26:55    阅读次数:163
HDU 5087 Revenge of LIS II(次大递增子序列)
Revenge of LIS II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1258    Accepted Submission(s): 423 Problem Description In comput...
分类:其他好文   时间:2015-08-17 17:27:02    阅读次数:200
LeetCode(34)Search for a Range
题目Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is not found in the...
分类:其他好文   时间:2015-08-17 17:25:36    阅读次数:111
poj 2431 Expedition(优先队列)
题目链接 http://poj.org/problem?id=2431 Expedition Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9243   Accepted: 2700 Description A group of cows grab...
分类:其他好文   时间:2015-08-17 17:25:37    阅读次数:130
POJ 2661-Factstone Benchmark(log()的应用)
题目地址:POJ 2661 题意:从1960年开始,每10年更新一次计算机的最长存储位数,其中,最开始的1960年字长为4位,以后每隔10年就增长一倍的长度。给你一个年份,问这一年时,计算机可以执行n!而不溢出的最大的n值。 思路:第n年的位数k=2^(2+(y-1960)/10),能放在k位中最大的无符号整数是(2^k)-1,如果是直接求不大于(2^k)-1的n!很容易溢出且速度慢,那么我们就...
分类:其他好文   时间:2015-08-17 17:26:45    阅读次数:121
最短路
Time Limit : 5000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 45   Accepted Submission(s) : 30 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们...
分类:其他好文   时间:2015-08-17 17:27:36    阅读次数:172
CO-PRIME(初探 莫比乌斯)NYOJ1066(经典)
CO-PRIME 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 This problem is so easy! Can you solve it? You are given a sequence which contains n integers a1,a2……an, your task is to find how many pa...
分类:其他好文   时间:2015-08-17 17:26:17    阅读次数:164
杭电(hdu)1181 变形课
变形课 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 18343    Accepted Submission(s): 6597 Problem Description 呃......变形课上Harry碰到了一...
分类:其他好文   时间:2015-08-17 17:26:57    阅读次数:144
【快速幂】【扩展欧几里德】【BSGS】【SDOI 2011】【bzoj 2242】计算器
2242: [SDOI2011]计算器Time Limit: 10 Sec Memory Limit: 512 MB Submit: 2077 Solved: 812 Description你被要求设计一个计算器完成以下三项任务: 1、给定y,z,p,计算Y^Z Mod P 的值; 2、给定y,z,p,计算满足xy≡ Z ( mod P )的最小非负整数; 3、给定y,z,p,计算满足Y^...
分类:其他好文   时间:2015-08-17 17:26:26    阅读次数:148
POJ 1679 The Unique MST(判断最小生成树_Kruskal)
Description Given a connected undirected graph, tell if its minimum spanning tree is unique.  Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree o...
分类:其他好文   时间:2015-08-17 17:24:13    阅读次数:104
leetcode:Binary Tree Paths
Binary Tree PathsGiven a binary tree, return all root-to-leaf paths.For example, given the following binary tree: All root-to-leaf paths are:[“1->2->5”, “1->3”]分析 深度搜索class Solution { public: v...
分类:其他好文   时间:2015-08-17 17:25:01    阅读次数:149
检查一个单词是否为其他字符串的子串
假定一个方法isSubstring.可检查一个单词是否为其他字符串的子串。给定两个字符串s1和s2。请编写代码检查s2是否为s1旋转而成,要求只调用一次isSubstring.(比如,waterbottle是erbottlewat旋转后的字符串)        上述分析正是这个问题的解法:直接调用isSubstring(s1s1,s2)即可。 bool isRotation(string s...
分类:其他好文   时间:2015-08-17 17:25:02    阅读次数:90
POJ 1019 Number Sequence (循环递增序列的的第K个值)
Number Sequence Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35823   Accepted: 10340 Description A single positive integer i is given. Write a program to fi...
分类:其他好文   时间:2015-08-17 17:24:53    阅读次数:85
滑动菜单
appleMenu              body{margin:0px auto;padding:0px auto;}         #menuBar{width:100%;height:70px;position:absolute;bottom:0px;text-align: center;}         #menuBar img{width:70px;height:70px...
分类:其他好文   时间:2015-08-17 17:25:44    阅读次数:100
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!