摘要: 第45页。 起点是最左边的点,每次把最左边能到的最右边的那个点作为标记点,然后更新起点。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #define ll long long 5 using namespace 阅读全文
posted @ 2017-09-21 15:25 lsy123 阅读(93) 评论(0) 推荐(0)
摘要: 44页。 一直取两端最小的字符,相等的时候要一直往里面缩直到发现应该选使得里面较小的先出来。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 const int N=20 阅读全文
posted @ 2017-09-18 21:15 lsy123 阅读(126) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=1852 蚂蚁在数轴正轴上爬,相遇就转身,到最边上掉光,问最短和最长时间。 n是长度,m是蚂蚁数目。 //相遇转身可以看成交错,掉落时间就是从起始点到终点 1 #include <cstdio> 2 #include <cstring> 3 #in 阅读全文
posted @ 2017-09-09 21:53 lsy123 阅读(117) 评论(0) 推荐(0)
摘要: 1 int mod_exp(int n,int x){ 2 int sum=1; 3 n=n%10; 4 while(x>0){ 5 if(x%2){ 6 sum=sum*n%10; 7 } 8 n=n*n%10; 9 x=x/2; 10 } 11 return sum; 12 } 例题 HDU 1 阅读全文
posted @ 2016-10-19 21:42 lsy123 阅读(110) 评论(0) 推荐(0)