青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

為生存而奔跑

   :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
  271 Posts :: 0 Stories :: 58 Comments :: 0 Trackbacks

留言簿(5)

我參與的團(tuán)隊(duì)

搜索

  •  

積分與排名

  • 積分 - 331733
  • 排名 - 74

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

http://code.google.com/codejam/contest/dashboard?c=32016#s=p2
Problem

In this problem, you have to find the last three digits before the decimal point for the number (3 + √5)n.

For example, when n = 5, (3 + √5)5 = 3935.73982... The answer is 935.

For n = 2, (3 + √5)2 = 27.4164079... The answer is 027.

Input

The first line of input gives the number of cases, T. T test cases follow, each on a separate line. Each test case contains one positive integer n.

Output

For each input case, you should output:

Case #X: Y
where X is the number of the test case and Y is the last three integer digits of the number (3 + √5)n. In case that number has fewer than three integer digits, add leading zeros so that your output contains exactly three digits.

 

Limits

1 <= T <= 100

Small dataset

2 <= n <= 30

Large dataset

2 <= n <= 2000000000

Sample

Input 
 

Output 
 
2
5
2
Case #1: 935
Case #2: 027


Analysis

Solving the large tests was a very different problem. The difficulty comes from the fact that √5 is irrational and for n close to 2000000000 you would need a lot of precision and a lot of time if you wanted to use the naive solution.

The key in solving the problem is a mathematical concept called conjugation. In our problem, we simply note that (3 - √5) is a nice conjugate for (3 + √5). Let us define

(1)     α := 3 + √5,   β := 3 - √5,   and Xn := αn + βn.
We first note that Xn is an integer. This can be proved by using the binomial expansion. If you write everything down you'll notice that the irrational terms of the sums cancel each other out.

Another observation is that βn < 1, so Xn is actually the first integer greater than αn. Thus we may just focus on computing the last three digits of X.

A side note. In fact, βn tends to 0 so quickly that that our problem would be trivial if we asked for the three digits after the decimal point. For all large values of n they are always 999.


SO, the last three digits of Xn-1 is what we want. We also know that X(n)=6X(n-1)-4X(n-2),X(0)=2,X(1)=6,so we can calc Xn easily.

code


posted on 2009-08-28 09:13 baby-fly 閱讀(601) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Algorithm
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            一本色道久久加勒比88综合| 久久久久久成人| 久久午夜精品一区二区| 欧美在线视频免费| 久久激情五月丁香伊人| 久久久久久久999精品视频| 久久综合给合久久狠狠色 | 久久躁狠狠躁夜夜爽| 久久人人97超碰精品888| 久久夜色精品国产噜噜av| 欧美国产高清| 国产精品丝袜91| 国内不卡一区二区三区| 在线播放日韩| 一本一本久久a久久精品综合妖精| 宅男精品视频| 久久精品国产99| 欧美成人在线免费视频| 一个色综合av| 久久全球大尺度高清视频| 亚洲欧美区自拍先锋| 在线亚洲一区| 午夜精品久久久久久久久久久| 久久精品二区| 亚洲麻豆av| 久久亚洲影音av资源网| 国产精品人人爽人人做我的可爱| 伊人久久亚洲影院| 亚洲欧美网站| 亚洲精品三级| 久久婷婷国产综合国色天香| 国产精品久久久久aaaa九色| 亚洲电影视频在线| 欧美在线视频观看免费网站| 91久久久久久国产精品| 亚洲一区在线直播| 欧美男人的天堂| 亚洲国产精品视频| 久久久人成影片一区二区三区观看| 亚洲黄色av一区| 久久av一区二区三区| 国产精品国产三级国产专播精品人| 最新亚洲激情| 欧美国内亚洲| 久久精品一区四区| 国产一区二区三区不卡在线观看| 亚洲综合色视频| 亚洲人成网站影音先锋播放| 久久久久久久97| 国产揄拍国内精品对白| 欧美在线观看视频一区二区| 这里只有精品在线播放| 欧美日韩精品三区| 一区二区三区久久精品| 亚洲国产欧美国产综合一区| 美女精品国产| 在线国产亚洲欧美| 美女黄毛**国产精品啪啪| 欧美主播一区二区三区| 国模一区二区三区| 男人的天堂成人在线| 玖玖视频精品| 日韩视频一区二区三区在线播放免费观看 | 韩国三级电影一区二区| 久久成人一区| 午夜影院日韩| 激情综合色丁香一区二区| 久久先锋资源| 欧美成人激情视频| 一区二区av在线| 在线午夜精品| 黑丝一区二区三区| 亚洲一区二区三区在线| 欧美人与禽猛交乱配视频| 一区二区激情视频| 一区二区三区日韩精品视频| 国产精品免费看片| 久久精品国产免费看久久精品| 久久精品国产精品亚洲综合| 亚洲国产精品悠悠久久琪琪| 最近看过的日韩成人| 欧美日韩一区二区高清| 欧美一级黄色录像| 久久野战av| 亚洲图片欧美日产| 欧美与欧洲交xxxx免费观看 | 免费视频最近日韩| 欧美日韩爆操| 久久精品亚洲一区二区三区浴池| 毛片一区二区| 亚洲午夜一二三区视频| 欧美中文字幕精品| 99视频精品全部免费在线| 午夜精品区一区二区三| 亚洲美女电影在线| 久久国产高清| 亚洲午夜精品久久| 久久一区二区三区超碰国产精品| 亚洲特级片在线| 久久尤物视频| 亚久久调教视频| 欧美精品成人91久久久久久久| 欧美在线视频日韩| 欧美日本高清| 欧美aa在线视频| 国产日韩精品视频一区| 亚洲精品美女在线观看播放| 国内精品国产成人| 一区二区三区视频在线看| 亚洲激情自拍| 久久久国产一区二区三区| 亚洲欧美日韩国产中文| 欧美精品日韩综合在线| 欧美大片一区二区| 国外成人在线视频| 99精品国产福利在线观看免费| 狠狠色狠狠色综合日日tαg| 亚洲免费人成在线视频观看| 亚洲视频一二三| 欧美精品亚洲| 亚洲国产精品久久91精品| 精品成人一区二区三区| 久久激情网站| 久久精品夜色噜噜亚洲aⅴ| 国产精自产拍久久久久久蜜| 亚洲午夜视频| 亚洲欧美制服另类日韩| 欧美日韩综合视频| 亚洲午夜高清视频| 午夜亚洲性色福利视频| 国产精品成人免费| 亚洲资源av| 久久国产高清| 91久久久久久久久| 亚洲第一网站| 久久九九免费视频| 老司机一区二区三区| 黄色亚洲在线| 久久精彩视频| 免费亚洲电影在线观看| 亚洲黄页视频免费观看| 美女黄网久久| 亚洲人成啪啪网站| 亚洲图片欧洲图片日韩av| 国产精品豆花视频| 亚洲男人av电影| 久久综合五月| 日韩一区二区福利| 欧美日韩精品综合在线| 国产精品99久久久久久久女警 | 一区二区三区黄色| 欧美日韩在线播放一区| 艳女tv在线观看国产一区| 午夜精品久久久久久久| 国产毛片精品视频| 久久久久久久波多野高潮日日| 欧美国产大片| 亚洲欧美日韩国产一区二区| 激情成人av在线| 欧美精品在线观看91| 亚洲欧美国产精品va在线观看| 久久综合一区二区| 亚洲图色在线| 在线观看日韩专区| 欧美日一区二区在线观看 | 欧美成人免费网站| 一区二区日韩欧美| 国产亚洲毛片在线| 欧美精品一区三区| 欧美亚洲一区在线| 亚洲人成高清| 久久久久国色av免费看影院| 亚洲伦理在线观看| 国产主播一区二区三区| 欧美日本网站| 久久性色av| 亚洲欧美日韩天堂| 亚洲欧洲一区二区在线播放| 久久国产主播| 在线视频欧美日韩| 在线观看视频一区二区欧美日韩| 欧美午夜精品| 欧美aⅴ一区二区三区视频| 亚洲一二三四区| 亚洲人成啪啪网站| 欧美sm重口味系列视频在线观看| 欧美亚洲一级| 亚洲女人天堂成人av在线| 亚洲乱码视频| 亚洲欧洲日产国产网站| 国产一区二区成人| 国产精品美女久久久免费| 欧美精品成人| 裸体丰满少妇做受久久99精品| 亚洲欧美日韩精品久久亚洲区| 亚洲毛片在线免费观看| 亚洲激情在线激情| 免费在线观看精品| 久久亚洲欧美| 久久免费精品视频|