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

為生存而奔跑

   :: 首頁 :: 聯系 :: 聚合  :: 管理
  271 Posts :: 0 Stories :: 58 Comments :: 0 Trackbacks

留言簿(5)

我參與的團隊

搜索

  •  

積分與排名

  • 積分 - 331734
  • 排名 - 74

最新評論

閱讀排行榜

評論排行榜

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) 評論(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>
            亚洲国产mv| 尤物在线精品| 久久成人国产精品| 亚洲一线二线三线久久久| 亚洲一级黄色| 欧美亚洲一区| 鲁大师成人一区二区三区| 欧美成人福利视频| 欧美午夜精品久久久久久孕妇| 国产精品白丝av嫩草影院| 国产精品最新自拍| 1769国内精品视频在线播放| 亚洲激情av在线| 宅男精品视频| 久久久久高清| 亚洲国产mv| 中文精品视频一区二区在线观看| 亚洲五月婷婷| 久久久亚洲综合| 欧美日韩亚洲综合在线| 国产亚洲va综合人人澡精品| 亚洲精品国产精品乱码不99按摩 | 亚洲激情不卡| 欧美一二区视频| 欧美国产日韩一区二区| 国产精品视频yy9299一区| 亚洲大黄网站| 欧美中文在线字幕| 亚洲日本中文字幕免费在线不卡| 亚洲欧美激情诱惑| 欧美日韩免费在线| 亚洲级视频在线观看免费1级| 新67194成人永久网站| 亚洲激情成人在线| 久久精品亚洲精品国产欧美kt∨| 欧美国产综合视频| 黄色精品网站| 欧美一区二区视频在线观看2020| 亚洲精品国产品国语在线app| 久久久国产一区二区| 国产精品久久久久久久7电影| 亚洲精品免费观看| 免费亚洲视频| 久久久久九九视频| 国内精品免费在线观看| 欧美在线观看视频| 亚洲网站视频| 国产精品美女一区二区| 亚洲自拍偷拍视频| av不卡在线| 国产精品高精视频免费| 亚洲视频大全| 日韩视频三区| 午夜欧美大片免费观看| 影音先锋中文字幕一区| 久久国产精品一区二区三区四区 | 亚洲男人av电影| 亚洲另类自拍| 欧美激情麻豆| 日韩西西人体444www| 亚洲精品久久视频| 欧美巨乳波霸| 这里只有精品电影| 亚洲一区二区成人在线观看| 国产精品超碰97尤物18| 亚洲天天影视| 亚洲视频自拍偷拍| 国产精品视频99| 久久久91精品国产一区二区精品| 欧美在线啊v一区| 在线日韩av| 亚洲人成小说网站色在线| 欧美激情精品久久久久久久变态 | 国产资源精品在线观看| 久久精品理论片| 久久久久久久综合日本| 最新成人av在线| 日韩视频不卡中文| 国产精品亚洲аv天堂网| 久久久亚洲人| 欧美精品一区二区三区很污很色的 | 黄色欧美日韩| 欧美激情一区在线观看| 欧美激情第一页xxx| 亚洲免费在线视频| 久久精品国产成人| 亚洲国产欧美日韩精品| 亚洲看片免费| 国产日产欧产精品推荐色 | 欧美激情精品久久久久久蜜臀| 欧美绝品在线观看成人午夜影视 | 一区二区三区毛片| 亚洲欧美日韩视频二区| 曰韩精品一区二区| 99热在线精品观看| 国产综合久久久久久| 亚洲第一久久影院| 国产精品资源在线观看| 久热re这里精品视频在线6| 欧美va天堂| 欧美一区二区在线观看| 美女在线一区二区| 亚洲欧美在线免费| 麻豆成人在线| 久久国产精品99国产精| 欧美黄色一级视频| 久久都是精品| 欧美性理论片在线观看片免费| 久热re这里精品视频在线6| 欧美日韩一区二区在线观看| 久久天天躁狠狠躁夜夜爽蜜月| 欧美日韩精品免费观看| 美女脱光内衣内裤视频久久影院 | 久久精品一区二区三区四区 | 久久蜜桃精品| 亚洲欧美日韩区 | 亚洲人成人一区二区在线观看| 亚洲视频综合| 夜久久久久久| 免费黄网站欧美| 久久影院亚洲| 国产自产v一区二区三区c| 亚洲尤物精选| 亚洲欧美变态国产另类| 欧美日韩国产999| 亚洲黄页视频免费观看| 亚洲高清在线| 久久综合网hezyo| 免费影视亚洲| 永久免费毛片在线播放不卡| 午夜在线视频一区二区区别| 亚洲免费视频网站| 欧美天堂在线观看| 99热免费精品在线观看| 亚洲视频免费看| 欧美日韩三级一区二区| 亚洲国产日韩精品| 亚洲精华国产欧美| 久久久亚洲人| 欧美成熟视频| 亚洲精品日韩欧美| 欧美精品日韩三级| 日韩亚洲一区二区| 亚洲一区在线观看免费观看电影高清| 欧美日韩国产页| av不卡在线观看| 午夜欧美电影在线观看| 国内不卡一区二区三区| 久久久五月天| 亚洲日本va午夜在线影院| 中文日韩在线视频| 国产精品专区第二| 久久精品亚洲精品国产欧美kt∨| 免费人成网站在线观看欧美高清| 影音先锋亚洲视频| 欧美噜噜久久久xxx| 亚洲一级免费视频| 麻豆国产精品va在线观看不卡| 国产欧美一区二区三区另类精品 | 亚洲黄色在线观看| 一区二区三区 在线观看视频| 欧美午夜不卡视频| 欧美一区二区三区久久精品 | 亚洲欧美日韩成人| 国产一区二区三区在线观看免费视频| 久久裸体视频| 一区二区欧美激情| 久久综合九色综合网站| 亚洲久久一区二区| 国产精品入口66mio| 久久久噜噜噜久久| 亚洲精品婷婷| 久久免费视频观看| 一区二区三区四区精品| 国产亚洲精品一区二区| 欧美国产视频日韩| 性做久久久久久| 亚洲精品字幕| 久久亚洲一区| 亚洲影院一区| 亚洲激情视频网站| 国产色产综合色产在线视频| 欧美精品1区| 久久久久久久综合狠狠综合| 一本久道久久综合中文字幕| 欧美.com| 久久综合电影| 欧美制服丝袜第一页| 正在播放欧美一区| 亚洲高清一区二| 狠狠色香婷婷久久亚洲精品| 国产精品区一区| 欧美日韩精品系列| 欧美成人中文字幕在线| 久久久99免费视频| 欧美一区二区三区在线视频| 亚洲午夜久久久久久久久电影网| 欧美激情一区二区在线| 毛片一区二区三区| 久久久蜜桃精品|