1、poj ACM题求高精度幂Time Limit: 500MSMemory Limit: 10000KTotal Submissions: 77451Accepted: 18371Description对数值很大、精度很高的数进行高精度计算是一类十分常见的问题。比如,对国债进行计算就是属于这类问题。 现在要你解决的问题是:对一个实数R( 0.0 R 99.999 ),要求写程序精确计算 R 的 n 次方(Rn),其中n 是整数并且 0 n = 25。InputT输入包括多组 R 和 n。 R 的值占第 1 到第 6 列,n 的值占第 8 和第 9 列。Output对于每组输入,要求输出一行,该行
2、包含精确的 R 的 n 次方。输出需要去掉前导的 0 后不要的 0 。如果输出是整数,不要输出小数点。Sample Input95.123 120.4321 205.1234 156.7592 998.999 101.0100 12Sample Output548815*830194541.899025343415715973535967221869852721.0000000514855464107695612199451127676715483848176020072635120383542976301346240143992025569.9285737012664880411466549
3、9331870370751166629547672049395302429448126.76412102161816443020690903717327667290429072743629540498.1075960194566517745610440100011.126825*720661201487-3279Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 145788Accepted: 24911Description企业喜欢用容易被记住的电话号码。让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。例如,你
4、需要给滑铁卢大学打电话时,可以拨打TUT-GLOP。有时,只将电话号码中部分数字拼写成单词。当你晚上回到酒店,可以通过拨打310-GINO来向Ginos订一份pizza。让电话号码容易被记住的另一个办法是以一种好记的方式对号码的数字进行分组。通过拨打必胜客的“三个十”号码3-10-10-10,你可以从他们那里订pizza。 电话号码的标准格式是七位十进制数,并在第三、第四位数字之间有一个连接符。电话拨号盘提供了从字母到数字的映射,映射关系如下: A, B, 和C 映射到 2 D, E, 和F 映射到 3 G, H, 和I 映射到 4 J, K, 和L 映射到 5 M, N, 和O 映射到 6
5、P, R, 和S 映射到 7 T, U, 和V 映射到 8 W, X, 和Y 映射到 9 Q和Z没有映射到任何数字,连字符不需要拨号,可以任意添加和删除。 TUT-GLOP的标准格式是888-4567,310-GINO的标准格式是310-4466,3-10-10-10的标准格式是310-1010。 如果两个号码有相同的标准格式,那么他们就是等同的(相同的拨号) 你的公司正在为本地的公司编写一个电话号码薄。作为质量控制的一部分,你想要检查是否有两个和多个公司拥有相同的电话号码。 Input输入的格式是,第一行是一个正整数,指定电话号码薄中号码的数量(最多100000)。余下的每行是一个电话号码。
6、每个电话号码由数字,大写字母(除了Q和Z)以及连接符组成。每个电话号码中只会刚好有7个数字或者字母。Output对于每个出现重复的号码产生一行输出,输出是号码的标准格式紧跟一个空格然后是它的重复次数。如果存在多个重复的号码,则按照号码的字典升序输出。如果输入数据中没有重复的号码,输出一行: No duplicates. Sample Input124873279ITS-EASY888-45673-10-10-10888-GLOPTUT-GLOP967-11-11310-GINOF101010888-1200-4-8-7-3-2-7-9-487-3279Sample Output310-1010
7、 2487-3279 4888-4567 3HangoverTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 61305Accepted: 28970DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (Were assuming that the cards must be perpendic
8、ular to the table.) With two cards you can make the top card overhang the bottom one by half a card length, and the bottom one overhang the table by a third of a card length, for a total maximum overhang of 1/2 + 1/3 = 5/6 card lengths. In general you can make n cards overhang by 1/2 + 1/3 + 1/4 + .
9、 + 1/(n + 1) card lengths, where the top card overhangs the second by 1/2, the second overhangs tha third by 1/3, the third overhangs the fourth by 1/4, etc., and the bottom card overhangs the table by 1/(n + 1). This is illustrated in the figure below.InputThe input consists of one or more test cas
10、es, followed by a line containing the number 0.00 that signals the end of the input. Each test case is a single line containing a positive floating-point number c whose value is at least 0.01 and at most 5.20; c will contain exactly three digits.OutputFor each test case, output the minimum number of
11、 cards necessary to achieve an overhang of at least c card lengths. Use the exact output format shown in the examples.Sample Input1.003.710.045.190.00Sample Output3 card(s)61 card(s)1 card(s)273 card(s)Financial ManagementTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 68553Accepted: 33375D
12、escriptionLarry graduated this year and finally has a job. Hes making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out whats been going on with his money.
13、Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance. InputThe input will be twelve lines. Each line will contain the closing balance of
14、his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included. OutputThe output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately
15、 by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output. Sample Input100.00489.1212454.121234.10823.05109.205.271542.25839.1883.991295.011.75Sample Output$1581.42I Think I Need a HouseboatTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 5
16、5699Accepted: 23084DescriptionFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since
17、 Fred is hoping to live in this house the rest of his life, he needs to know if his land is going to be lost to erosion. After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects
18、the circle being the X axis. Locations below the X axis are in the water. The semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.) InputThe first line of input will be a positive integer indicating how many data sets will be included (N). Each of the next N
19、 lines will contain the X and Y Cartesian coordinates of the land Fred is considering. These will be floating point numbers measured in miles. The Y coordinate will be non-negative. (0,0) will not be given.OutputFor each data set, a single line of output should appear. This line should take the form
20、 of: “Property N: This property will begin eroding in year Z.” Where N is the data set (counting from 1), and Z is the first year (start from 1) this property will be within the semicircle AT THE END OF YEAR Z. Z must be an integer. After the last data set, this should print out “END OF OUTPUT.” Sam
21、ple Input21.0 1.025.0 0.0Sample OutputProperty 1: This property will begin eroding in year 1.Property 2: This property will begin eroding in year 20.END OF OUTPUT.Hint1.No property will appear exactly on the semicircle boundary: it will either be inside or outside. 2.This problem will be judged auto
22、matically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines. 3.All locations are given in miles. 生理周期Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 72976Accepted: 21737Description人生来就有三个生理周期,分别为体力
23、、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。对于每个人,我们想知道何时三个高峰落在同一天。对于每个周期,我们会给出从当前年份的第一天开始,到出现高峰的天数(不一定是第一次高峰出现的时间)。你的任务是给定一个从当年第一天开始数的天数,输出从给定时间开始(不包括给定时间)下一次三个高峰落在同一天的时间(距给定时间的天数)。例如:给定时间为10,下次出现三个高峰同天的时间是12,则输出2(注意这里不是3)。I
24、nput输入四个整数:p, e, i和d。 p, e, i分别表示体力、情感和智力高峰出现的时间(时间从当年的第一天开始计算)。d 是给定的时间,可能小于p, e, 或 i。 所有给定时间是非负的并且小于365, 所求的时间小于21252。 当p = e = i = d = -1时,输入数据结束。Output从给定时间起,下一次三个高峰同天的时间(距离给定时间的天数)。 采用以下格式: Case 1: the next triple peak occurs in 1234 days. 注意:即使结果是1天,也使用复数形式“days”。Sample Input0 0 0 00 0 0 1005
25、20 34 3254 5 6 7283 102 23 320203 301 203 40-1 -1 -1 -1Sample OutputCase 1: the next triple peak occurs in 21252 days.Case 2: the next triple peak occurs in 21152 days.Case 3: the next triple peak occurs in 19575 days.Case 4: the next triple peak occurs in 16994 days.Case 5: the next triple peak occ
26、urs in 8910 days.Case 6: the next triple peak occurs in 10789 days.DNA SortingTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 49942Accepted: 19535DescriptionOne measure of unsortedness in a sequence is the number of pairs of entries that are out of order with respect to each other. For inst
27、ance, in the letter sequence DAABEC, this measure is 5, since D is greater than four letters to its right and E is greater than one letter to its right. This measure is called the number of inversions in the sequence. The sequence AACEDGG has only one inversion (E and D)-it is nearly sorted-while th
28、e sequence ZWQM has 6 inversions (it is as unsorted as can be-exactly the reverse of sorted). You are responsible for cataloguing a sequence of DNA strings (sequences containing only the four letters A, C, G, and T). However, you want to catalog them, not in alphabetical order, but rather in order o
29、f sortedness, from most sorted to least sorted. All the strings are of the same length. InputThe first line contains two integers: a positive integer n (0 n = 50) giving the length of the strings; and a positive integer m (0 m = 100) giving the number of strings. These are followed by m lines, each
30、containing a string of length n.OutputOutput the list of input strings, arranged from most sorted to least sorted. Since two strings can be equally sorted, then output them according to the orginal order.Sample Input10 6AACATGAAGGTTTTGGCCAATTTGGCCAAAGATCAGATTTCCCGGGGGGAATCGATGCATSample OutputCCCGGGG
31、GGAAACATGAAGGGATCAGATTTATCGATGCATTTTTGGCCAATTTGGCCAAA玛雅历Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 41850Accepted: 12759Description上周末,M.A. Ya教授对古老的玛雅有了一个重大发现。从一个古老的节绳(玛雅人用于记事的工具)中,教授发现玛雅人使用了一个一年有365天的叫做Haab的历法。这个Haab历法拥有19个月,在开始的18个月,一个月有20天,月份的名字分别是pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu。这些月份中的日期用0到19表示。Haab历的最后一个月叫做uayet,它只有5天,用0到4
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1