- 博客(14)
- 收藏
- 关注
原创 golang学习遇到的类型判断的问题
这边写用于个人后面查阅,大概率对其他读者没有帮助,就不浪费他人时间了先贴一段代码:package main import( "fmt" "reflect")type I1 interface { One()}type S1 struct{ I1 num int}func (s1 *S1) One(){ fmt.Printf("type: S1 value: %+...
2019-11-04 17:48:17 685
原创 [KMP][后缀数组] poj2406 Power Strings
DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = “abc” and b = “def” then a*b = “abcdef”. If we think of concatenation as multiplication, exponentiation
2016-07-31 21:05:30 349
原创 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
∑i=1mϕ(i∗n)=ϕ(p)∗∑i=1m[gcd(i,p)==1]ϕ(i∗n/p)+∑i=1m[p|i]ϕ(i∗n)=ϕ(p)∗∑i=1m[gcd(i,p)==1]ϕ(i∗n/p)+∑i=1m[p|i](p∗ϕ(i/p∗n))=ϕ(p)∗∑i=1m[gcd(i,p)==1]ϕ(i∗n/p)+∑i=1m/p(p∗ϕ(i∗n))=ϕ(p)∗∑i=1m[gcd(i,p)==1]ϕ(i∗n/p)+∑i=
2016-07-22 22:15:16 68678
原创 【map乱搞】 HDU5126 GCD
【map乱搞】 HDU5126 GCD题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5726题目大意: 给你n个数,m个询问。 每个询问给定ll,rr,问任取llll ,rrrr,使得区间[ll,rr][ll,rr]的GCD=区间[l,r][l,r]的GCD,问[ll,rr][ll,rr]的方案数。解题思路,先预处理把所有的GCD的结果搞出来,
2016-07-19 18:52:36 261
原创 【带权并查集】POJ1988
题目链接在这里 题目大概的意思就是两种操作,一种是把含有x的整个栈放到含有y的整个栈上面。另外一种是问x下面有多少个物品。 物品数目是30,000以内,操作次数在100,000以内。一开始的时候我们想的是直接模拟?这个毫无疑问是不可以的。 但是一眼看过去,似乎和并查集没什么关系?这个时候,我们从栈开始分析。计算一个物品下面有多少个物品,那么有两种计算方法:直接计算。栈里面的元素个数-当前距
2016-07-12 22:13:02 404
原创 [高斯消元]UVA 12961 Lottery
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4840The lottery BWS is played annually. In this lottery N people bet choosing K numbe
2016-03-11 17:54:27 492
原创 [区间DP]UVA 12960 Palindrome
A palindrome is a string that if reversed is equal to the original string. In other words, it is a stringthat, when read from back to front, is the same as the original string. For example, BANANAB is
2016-03-11 11:54:37 467
原创 [排序][stl乱搞] UVA 12957 Rectangle Park
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4836----------------------------------------------------------------------分割线------------------
2016-03-11 11:40:11 413
原创 [简单DP][完全背包]UVA 12955 Factorial
The factorial of a positive integer number N, denoted as N!, is defined as the product of all positiveinteger numbers smaller or equal to N. For example 4! = 4 × 3 × 2 × 1 = 24.Given a positive inte
2016-03-11 11:10:55 364
原创 [数学] uva 12954 Spiral
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4833----------------------------------------------------------------------------分割线------------
2016-03-11 11:04:23 396
原创 [简单DP] uva12951 Stock Market
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4830A beginner investor wants to learn how to invest in the stock market. As he does not have a
2016-03-11 10:38:03 442
原创 【数论】【分块】【乱搞】codeforces 616E Sum of Remainders
E. Sum of Remainderstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCalculate the value of the sum: n mod
2016-01-17 12:44:30 844 1
原创 HDU5492 Find a path (DP+水题)
/* 把公式简化一下 可以变成:(n+m-1)*sigma(a[i]*a[i])-sum*sum 我们用dp[i][j][k]表示从起点到点[i][j]时候,和为k的 sigma(a[i]*a[i])最小值 那么转移方程就是dp[i][j][k]=min(dp[i-1][j][k-table[i][j]],dp[i][j-1][k-table[i][j]]) +table[
2015-09-28 16:07:29 501
原创 codeforces 580 D.Kefa and Dishes(状压DP)
D. Kefa and Dishes原题:http://codeforces.com/contest/580/problem/DWhen Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. K
2015-09-23 12:48:45 791
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人