CY_

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2014年5月1日

摘要: //开始DP之旅,先来道简单的Problem Description A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequen... 阅读全文
posted @ 2014-05-01 11:30 CY_ 阅读(149) 评论(0) 推荐(0) 编辑

摘要: //大数继续,额,要吐了。Problem DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems.This problem requires that you write a program to compute the exact 阅读全文
posted @ 2014-05-01 10:31 CY_ 阅读(223) 评论(0) 推荐(0) 编辑

摘要: // 大数继续Problem DescriptionRecall the definition of the Fibonacci numbers:f1 := 1f2 := 2fn := fn-1 + fn-2 (n >= 3)Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b].InputThe input contains several test cases. Each test case consists of two non-negative integer 阅读全文
posted @ 2014-05-01 08:53 CY_ 阅读(138) 评论(0) 推荐(0) 编辑

2014年4月30日

摘要: // 继续大数,哎、、Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) + F(n-3) + F(n-4)Your task is to take a number as input, and print that Fibon 阅读全文
posted @ 2014-04-30 20:56 CY_ 阅读(141) 评论(0) 推荐(0) 编辑

摘要: //深刻认识到自己的粗心,为此浪费了一天。。Problem Description话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。Input本题目包含多组测试数据,请处理到文件结束。每一组测试数据在一行里面包含两个长度不大于400的正小数A和B。Output请在一行里面输出输出A+B的值,请输出最简形式。详细要求请见Sample Output。Sample Input1.1 2.91.1111111111 2 阅读全文
posted @ 2014-04-30 15:22 CY_ 阅读(232) 评论(0) 推荐(0) 编辑

2014年4月29日

摘要: 卡在hdu 1402 的高精度乘法了,要用FFT(快速傅里叶变换),然后看到了这个霍纳法则,顺便就写下来了。霍纳法则:求多项式值的一个快速算法。简单介绍:假设有n+2个数 , a0,a1,a2,a3,……an 和x组成的一个多项式,形式如下: a0*x^0+a1*x^1+a2*x^2+a3*x^3+……an*x^n ,通常都是一项一项的求和然后累加,这样的话要进行n* (n+1)/2 次乘法运算 和 n 次加法运算 ,而霍纳法则就是一个改进的一个算法。通过变换得到如下式子:(((……(((an+an-1)*x+an-2)*x+an-3)*x)+……)*x+a1)*x+a0 ,这种求值的方法便. 阅读全文
posted @ 2014-04-29 10:51 CY_ 阅读(1098) 评论(0) 推荐(0) 编辑

2014年4月28日

摘要: Problem DescriptionFibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3。计算第n项Fibonacci数值。Input输入第一行为一个整数N,接下来N行为整数Pi(1#includeusing namespace std;string add(string x,string y){ string ans ; int lenx = x.length(); int leny = y.length(); if(lenx=0;i--) { temp = x[i] - '0' + y[i] -... 阅读全文
posted @ 2014-04-28 16:33 CY_ 阅读(441) 评论(0) 推荐(0) 编辑

摘要: 转自博客园:http://www.cnblogs.com/xFreedom/archive/2011/05/16/2048037.html相信使用过MFC编程的朋友对CString这个类的印象应该非常深刻吧?的确,MFC中的CString类使用起来真的非常的方便好用。但是如果离开了MFC框架,还有没有这样使用起来非常方便的类呢?答案是肯定的。也许有人会说,即使不用MFC框架,也可以想办法使用MFC中的API,具体的操作方法在本文最后给出操作方法。其实,可能很多人很可能会忽略掉标准C++中string类的使用。标准C++中提供的string类得功能也是非常强大的,一般都能满足我们开发项目时使用。 阅读全文
posted @ 2014-04-28 16:03 CY_ 阅读(224) 评论(0) 推荐(0) 编辑

摘要: Problem DescriptionOneof the first users of BIT's new supercomputer was Chip Diller. He extended hisexploration of powers of 3 to go from 0 to 333 and he explored taking varioussums of those numbers.``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were hereto see the 阅读全文
posted @ 2014-04-28 15:54 CY_ 阅读(270) 评论(0) 推荐(0) 编辑

摘要: 题目描述Cainiao is a university student who loves ACM contest very much. It is a festival for him once when he attends ACM Asia Regional Contest because he always can find some famous ACMers there.Cainiao attended Asia Regional Contest Fuzhou Site on November 20, 2011. After he got seat map, he wanted t 阅读全文
posted @ 2014-04-28 09:46 CY_ 阅读(160) 评论(0) 推荐(0) 编辑