ACM_摸爬滚打
我是任玉琢
这个作者很懒,什么都没留下…
展开
-
uva11300
/** *uva11300 */#include#include#include#include#include#include#define max 1000010 using namespace std;long long m,sum,a[max],b[max],ans,t,i,k;int main(){ while(scanf("%lld",&t)!=EOF){原创 2013-09-30 20:00:57 · 628 阅读 · 0 评论 -
贪心算法uva11729解法
结束时间晚的放在开始率先执行。原创 2013-09-27 00:02:51 · 450 阅读 · 0 评论 -
杭电ACM2037
#include#include#include#include#includeusing namespace std;typedef struct time{ int beg; int end;}time;time a[105];int cmp(const void *a,const void *b){ //按照结束时间先后进行排序,先结束的节目是一定要看原创 2013-09-23 13:07:45 · 732 阅读 · 0 评论 -
zoj 3432 Find the Lost Sock(解决时间超时问题)
此题我不会,总是超时,在别处看到代码,如下:转自/http://hi.baidu.com/chenyy197/item/81b6a8fa920626673c14853e一:题目描述:Alice bought a lot of pairs of socks yesterday. But when she went home, she found that she has lo转载 2013-08-02 14:39:00 · 838 阅读 · 0 评论 -
HDU 2045 不容易系列之(3)—— LELE的RPG难题
我承认,这一道题我没做出来,我写的递归程序超时了。看了网上的题解,这里记录一下。假如前n-2个已经算出来了,那么我怎么算出第n个呢?我们第n-1个有两种情况,一个是与第一个不同,与n-2也不同,那么就只有一个颜色呢,就是f(n-1);另一个情况是n-1与第1个相同,则n有2*f(n-2)个,即:f(n)=f(n-1)+2*f(n-2)注意:这里的n>3代码如下:#i原创 2013-11-08 23:24:37 · 435 阅读 · 0 评论 -
poj3087
点击打开链接#include#includeusing namespace std;char a[105], b[105], c[210], d[210], s1[105], s2[105];int n, l, num, flag;int deal2(){ char *p; p = d; strncpy(s1, p, l); s1[l] = 0; p = &d[l];原创 2013-11-25 23:56:07 · 488 阅读 · 0 评论 -
poj2424(一周了,终于过了!)
一周了,终于过了,写过的难看的代码!#include#include#include#includeusing namespace std;int end1[105], end2[105], end3[105];int two, four, six;char a[10];int twoTable[105], fourTable[105], sixTable[10原创 2013-11-29 21:47:34 · 657 阅读 · 0 评论