上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 48 下一页
  2013年7月6日
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2115数学的特点在于不断的推导,此题还需要用到欧拉定理和逆元的相关性质,推荐博客(有部分小错误):http://www.cnblogs.com/vongang/archive/2013/06/04/3117370.html代码:#include #include #include #include #include #include #include #define ll long 阅读全文
posted @ 2013-07-06 16:24 夜-> 阅读(258) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2078简单递推代码:#include #include #include #include #include #include #define ll long longusing namespace std;const int N=10005;ll sum[N][50];int main(){ //freopen("data.in","r", 阅读全文
posted @ 2013-07-06 09:38 夜-> 阅读(127) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2370难题锻炼思维,水题锻炼细心。这个题有两个需要注意的地方1,关于前导零2,高精度代码:import java.math.BigInteger;import java.util.Scanner;public class Main { /** * @param args */ static final int N=2005; public static void main(Stri 阅读全文
posted @ 2013-07-06 09:37 夜-> 阅读(237) 评论(0) 推荐(0) 编辑
  2013年7月5日
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2396要注意细节代码:#include #include #include #include #include #include #define ll long longusing namespace std;const int N=1000005;ll sum[N];int main(){ //freopen("data.in","r",s 阅读全文
posted @ 2013-07-05 21:06 夜-> 阅读(155) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2533公式推导代码:#include #include #include #include #include #include #define ll long longusing namespace std;int main(){ //freopen("data.in","r",stdin); ll n,m; while(cin>> 阅读全文
posted @ 2013-07-05 20:24 夜-> 阅读(149) 评论(0) 推荐(0) 编辑
  2013年6月19日
摘要: 读错题了有没有呀,原来 lamps 是在边上的呀,当成是在点上的了,无语。直接一个dfs 就可以 从叶子节点开始,如果有必要转换 lamp 的状态则加一个仅包含 这个 lamp 的段然后向上扩展,对于某个子树,根据扩展上来的段的个数,将偶数段进行合并(这是最优选择),然后可能剩一个或者0个段没用上,再根据这个节点到父节点的lamp的状态进行分析是否要将剩下的段向上扩展。直到根节点。由于所给边的特殊性,可以直接遍历。代码:#include<iostream>#include<cstdio>#include<vector>#include<stack> 阅读全文
posted @ 2013-06-19 14:16 夜-> 阅读(305) 评论(0) 推荐(0) 编辑
  2013年6月18日
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2609数位DP 以前没怎么做过,自己憋了半天,还是看了标程,标程写的就是好呀。相关注释见代码:#include<iostream>#include<cstdio>#include<vector>#include<stack>#include<cstring>#include<queue>#include<algorithm>#include<cmath&g 阅读全文
posted @ 2013-06-18 19:54 夜-> 阅读(272) 评论(0) 推荐(0) 编辑
  2013年6月17日
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2605这个题卡的是优化,直观解法是在求x^y时 用快速羃,但会TLE快速羃其实就是把 y 变成了二进制 这样每求一次花费为 y 的二进制长度我又把 y 变成了十进制进行求解 虽然优化了 但还是超时 优化的不够好,看了一下题解我把 y 变成100000 进制 这样 y 的100000进制长度就变成了 2 只要事先打表,就可以快很多了 。代码:#include<iostream>#include<cstdio>#includ 阅读全文
posted @ 2013-06-17 18:24 夜-> 阅读(210) 评论(0) 推荐(0) 编辑
摘要: DP 思路是三维,但是时间肯定会超时,需要根据其特殊性质加两个标记数组,优化成二维。刚开始想了N久N久,没感觉,还是动手画了一下才有用呀,意淫再久,不如动手呀。代码:#include<iostream>#include<cstdio>#include<vector>#include<stack>#include<cstring>#include<queue>#include<algorithm>#include<cmath>#include<cstring>#include<str 阅读全文
posted @ 2013-06-17 11:19 夜-> 阅读(401) 评论(0) 推荐(0) 编辑
  2013年6月15日
摘要: 这个题比较简单,不需要多说,最直观的解法就是二分,思路很清晰,写起来也方便。但仅满足于这个是不够的,看了别人的代码,好像有O(n) 的解法,后来想了一下,的确可以,所以说,一道题可以有不同的解法。而且我个人认为,每一种解法,都是一种思想。二分代码:#include<iostream>#include<cstdio>#include<vector>#include<stack>#include<cstring>#include<queue>#include<algorithm>#include<cmath& 阅读全文
posted @ 2013-06-15 20:16 夜-> 阅读(224) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 48 下一页