01 2013 档案
USACO Section 3.2 Factorials (fact4)
摘要:Factorials The factorial of an integer N, written N!, is the product of allthe integers from 1 through N inclusive. The factorial quickly becomesvery large: 13! is too large to store in a 32-bit integer on mostcomputers, and 70! is too large for most floating-point variables. Yourtask is to find th. 阅读全文
posted @ 2013-01-31 11:24 cssystem 阅读(194) 评论(0) 推荐(0)
USACO Section 2.4 Fractions to Decimals (fracdec)
摘要:Fractions to Decimals Write a program that will accept a fraction of the form N/D, whereN is the numerator and D is the denominator and print the decimalrepresentation. If the decimal representation has a repeating sequenceof digits, indicate the sequence by enclosing it in brackets. For example,1.. 阅读全文
posted @ 2013-01-31 09:01 cssystem 阅读(431) 评论(0) 推荐(0)
USACO Section 2.4 Bessie Come Home (comehome)
摘要:Bessie Come HomeKolstad & BurchIt's dinner time, and the cows are out in their separate pastures.Farmer John rings the bell so they will start walking to the barn. Yourjob is to figure out which one cow gets to the barn first (the suppliedtest data will always have exactly one fastest cow).B 阅读全文
posted @ 2013-01-30 23:56 cssystem 阅读(333) 评论(0) 推荐(0)
USACO Section 2.4 Cow Tours (cowtour)
摘要:Cow ToursFarmer John has a number of pastures on his farm. Cow pathsconnect some pastures with certain other pastures, forming a field.But, at the present time, you can find at least two pastures thatcannot be connected by any sequence of cow paths, thus partitioningFarmer John's farm into multi 阅读全文
posted @ 2013-01-30 23:10 cssystem 阅读(854) 评论(0) 推荐(0)
USACO Section 2.4 Overfencing (maze1)
摘要:OverfencingKolstad and Schrijvers Farmer John went crazy and created a huge maze of fences out in afield. Happily, he left out two fence segments on the edges, and thuscreated two "exits" for the maze. Even more happily, the mazehe created by this overfencing experience is a `perfect' 阅读全文
posted @ 2013-01-30 23:06 cssystem 阅读(383) 评论(0) 推荐(0)
4.3.6 N皇后问题
摘要:Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。 Output 共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。 Sample Input1850 Sample Output19210 ... 阅读全文
posted @ 2013-01-03 19:55 cssystem 阅读(236) 评论(0) 推荐(0)
4.3.5 Sticks (POJ1011)
摘要:Problem DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and how long they were originally. Please help him and design a program wh 阅读全文
posted @ 2013-01-02 12:05 cssystem 阅读(140) 评论(0) 推荐(0)
1257: [CQOI2007]余数之和sum
摘要:Description给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值,其中k mod i表示k除以i的余数。 例如j(5, 3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3 mod 5=0+1+0+3+3=7Input输入仅一行,包含两个整数n, k。Output输出仅一行,即j(n, k)。Sample Input5 3Sample Output7HINT 50%的数据满足:1<=n, k<=1000100%的数据满足:1<=n ,k<=10^9思路: 阅读全文
posted @ 2013-01-01 23:25 cssystem 阅读(381) 评论(0) 推荐(0)


点击右上角即可分享
微信分享提示