自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 资源 (11)
  • 问答 (1)
  • 收藏
  • 关注

转载 2010最危险的编程错误

历史上第一个bug 网络无处不在的今天,安全问题日益严峻,攻击事件层出不穷,应该说,软件系统中代码存在安全漏洞是主要的祸因之一。而这实际上反映了软件开发人员在编程的安全性方面缺乏必要的培训和常识。由CWS(美国国土安全部下属的软件保证项目)与SANS(权威安全培训组织)联合编制的最危险的25个编程错误,是软件开发人员非常好的快速学习资料。日前,两个机构发布了2010年的编程错误列表

2010-02-19 20:42:00 941

原创 笑一笑3

1.《床上功夫》却说貂禅为了使董卓吕布二人反目,便同时与二人勾搭。这一日,董卓与吕布在一起喝酒,董卓道:“我前天和貂禅干了那事,她的床上功夫真不错,比我老婆强多了。”吕布道:“不瞒你说,我昨天也和貂禅干了那事,确实,比你老婆床上功夫强多了!”2.《轮到你了》话说马超为报父仇,攻打曹操。曹操在潼关之战与马超一战惨败,仓皇逃窜。马超在后面追。追的曹操脱了长袍,割了长髯。两个人一个在前面跑,一个在后

2010-02-03 22:37:00 865

原创 笑一笑2

某日发现手机不见了,翻遍包包以及屋中各个角落,未果。遂郁闷地跌坐地上,从口袋掏出手机,给大家群发短信:我手机丢了 有一次坐公交拿了IC卡排队上车,前面一个人是扔硬币的,我大脑短路跟着把IC卡扔进去了…… 一次大家打麻将停电了,就点根蜡烛继续打,后来有人嫌热,嚷嚷“喂~把电扇打开”大家忙劝“不行不行,蜡烛会被吹灭。 高中时候,班里一哥们,1981年生,不大,就是特老相.....  以下是

2010-02-02 22:53:00 834

原创 笑一笑1

1.时不时的会跟我妈小吵小闹的,某次,我妈在争不过我的时候,很淡定的骂了一句“去你妈的” 。2.知道你过得不好,我也就安心了3.伯母你好,我是你儿子的男朋友4.新世纪女性:上得了厅堂,下得了厨房,写得了代码,查得出异常,杀得了木马, 翻得了围墙,开得起好车,买得起新房,斗得过二奶,打得过流氓... 5. 对你微笑,纯属礼貌 6.忙ing……有事尽管骚扰我……只要我能帮的,保证不

2010-02-02 22:22:00 713

转载 一个程序员的多年珍藏

程序员珍藏的东西会是什么?呵呵,除了平时写的代码,就是那些百看不厌的电子书了。 昨天很郁闷,我用了5年的移动硬盘,莫名奇妙的坏掉了。里面40G的资料全部报销了。 为了不再重蹈覆辙,我决定把重要的电子书都放到网络硬盘上去备份。索性将这些资料的下载方式公布出来,与大家分享,一定会有你想要的! 下载的兄弟注意了,点击下载后,可以在url中看到后缀名:),如果把后缀名改错了就看不了了,所有的资料都有人下载

2010-02-01 16:21:00 1082

转载 gch文件之浅谈GCC预编译头技术

——谨以此文,悼念我等待MinGW编译时逝去的那些时间。其 实刚开始编程的时候,我是丝毫不重视编译速度之类的问题的,原因很简单,因为那时我用BASICA。后来一直用到C++ Builder,尽管Borland的广告无时无刻不在吹嘘其编译速度,我却从没有对这个问题上心过,因为心里根本没有“编译速度慢”这种概念。没有坏,哪来好?所谓矛盾的对立统一。遇到的第一个“慢”的编译器也许是javac,但

2010-02-01 14:02:00 3830 1

IEProxy IE代理

IE代理 免费代理 代理服务器 快速的代理 上网代理 浏览器免费代理 代理服务器地址列表 代理服务器软件 代理IP 代理在线 Internet Explorer 免费代理 免费代理服务器 免费代理服务器地址 免费代理软件 代理IP 代理服务器设置 通过此软件可以方便的设置IE代理,并且可以搜索网上免费的代理服务器 1.应用代理 联网搜索可用代理,用户可以通过选择列表框中的某个代理后单击应用代理或直接双击列表框中的某一行设置代理 2.联网刷新 联网搜索可用代理,显示在列表框中。对于用户保存的代理会显示在列表最上方 联网刷新会与实际的网速相关,可能需要几秒至几十秒。若网速过慢,请耐心等待。 3.开启/关闭代理 软件开始运行时可自动检测是否已经使用代理,若已使用,则按钮为关闭代理。若没有使用代理,则显示开启代理。在设置代理后会在两种状态中切换 4.软件设置 快捷键为F12 4.1可以设置软件开机自启动 4.2使用某个代理后可以自动测试代理是否可用。此选项与测试的代理速度有关,当代理不可用或速度过慢的时候可能需要几十秒,一般几秒即可。可以在右方按提示输入测试网址。默认为www.baidu.com 4.3对于使用锐捷认证的用户可以选择启动后启动锐捷,不过需要选择锐捷的安装目录。O(∩_∩)O~其实可以在这里选择任意软件跟随IEProxy启动,这要选择了正确的路径,不过不要选择本软件的地址,否则会进入死循环,桌面蹦出几十个IEProxy窗口(*^__^*) 嘻嘻…… 4.4自动判断锐捷获得IP是否正确,由于时间关系,暂时没有完成 4.5软件更新,可联系到作者csdn主页,下载最新版 5.增加新代理 输入代理地址和端口,并进行相应选择后,新增代理。可以选择长久保存代理复选框。也可以通过点击清空保存按钮清空保存的所有的代理。 6.软件相关 快捷键为F1 可以查看软件更新内容和作者的相关信息 软件相关信息 花两天多一点的时间写出来的一个小的搜寻代理程序,有点粗糙,会继续更新 只不过这一段时间会比较忙,软件更新暂时到此为止,除了设置对话框中屏蔽掉的一个功能,最初规划的功能还有一些没实现,界面也没怎么弄,两个月后接着更新,谢谢关注!有比较好的建议欢迎留言或Email ver 4.0 Beta 1.增加软件设置功能具体设置有: 1.1开机自启动 1.2选择代理后自动判断是否可用 1.3开机后自启动锐捷 1.4启动锐捷后判断IP是否正确 1.5软件更新 2.更改设置界面Tab键的顺序 3.更改主界面Tab键的顺序 4.修改设置界面中static控件覆盖 5.增加对F1键到相关的响应 6.增加对F2键到设置响应 7.完善了控件对回车的响应,包括设置 Dialog和about Dialog中的控件 8.修改设置后判断代理是否可用提示错误 9.增加密码编辑框Password属性 10.修改置顶复选框的问题 11.修改连续刷新造成的代理重复问题 12.增加了测试网站不用输入类型的功能,增加了输入提示,连接失败提示框加入测试网址可能错误的提示 13.完善了右击托盘图标的设置功能 ver 3.0 Beta 1.增加初始化时显示上次的代理列表功能 2.完善长期保存功能 3.增加清空保存功能 4.增加初始化时读取保存的代理功能 5.修改置顶功能在重置时的错误响应 6.修改static控件覆盖 ver 2.3 Beta 1.增加了所有控件对回车键的响应 2.增加置顶功能 3.更改所有控件Tab顺序 4.修改了按钮内容提示不太准确问题 ver 2.2 Beta 1.增减双击直接设置功能 2.增加最小化到托盘功能 3.修改关于信息 ver 2.0 Beta 1.增加动态更新功能 2.增加 手动增加代理功能 3.更换图标 4.去掉数据库存储 下载地址:http://download.csdn.net/user/Lethe1989 个人主页:http://hi.csdn.net/link.php?url=http://blog.csdn.net%2Fl:[email protected] 欢迎提供建议,谢谢O(∩_∩)O~

2009-09-19

poj 1061 青蛙的约会

因为源代码和解题报告暂时还有用,只上传了测试用例, 用的是扩展欧几里德算法 可是参考网址http://blog.csdn.net/Fioman/archive/2008/05/18/2455698.aspx 上的算法 青蛙的约会 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36755 Accepted: 4913 Description 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。 我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样我们就得到了一条首尾相接的数轴。设青蛙A的出发点坐标是x,青蛙B的出发点坐标是y。青蛙A一次能跳m米,青蛙B一次能跳n米,两只青蛙跳一次所花费的时间相同。纬度线总长L米。现在要你求出它们跳了几次以后才会碰面。 Input 输入只包括一行5个整数x,y,m,n,L,其中x≠y < 2000000000,0 < m、n < 2000000000,0 < L < 2100000000。 Output 输出碰面所需要的跳跃次数,如果永远不可能碰面则输出一行"Impossible" Sample Input 1 2 3 4 5 Sample Output 4 Source 浙江

2009-06-01

poj 1007 DNA Sorting

DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 34868 Accepted: 13480 Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, 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 the 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 of ``sortedness'', from ``most sorted'' to ``least sorted''. All the strings are of the same length. Input The 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 containing a string of length n. Output Output 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 Input 10 6 AACATGAAGG TTTTGGCCAA TTTGGCCAAA GATCAGATTT CCCGGGGGGA ATCGATGCAT Sample Output CCCGGGGGGA AACATGAAGG GATCAGATTT ATCGATGCAT TTTTGGCCAA TTTGGCCAAA Source East Central North America 1998

2009-06-01

poj 1006 Biorhythms 生理周期

Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53539 Accepted: 15282 Description Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is one peak in each period of a cycle. At the peak of a cycle, a person performs at his or her best in the corresponding field (physical, emotional or mental). For example, if it is the mental curve, thought processes will be sharper and concentration will be easier. Since the three cycles have different periods, the peaks of the three cycles generally occur at different times. We would like to determine when a triple peak occurs (the peaks of all three cycles occur in the same day) for any person. For each cycle, you will be given the number of days from the beginning of the current year at which one of its peaks (not necessarily the first) occurs. You will also be given a date expressed as the number of days from the beginning of the current year. You task is to determine the number of days from the given date to the next triple peak. The given date is not counted. For example, if the given date is 10 and the next triple peak occurs on day 12, the answer is 2, not 3. If a triple peak occurs on the given date, you should give the number of days to the next occurrence of a triple peak. Input You will be given a number of cases. The input for each case consists of one line of four integers p, e, i, and d. The values p, e, and i are the number of days from the beginning of the current year at which the physical, emotional, and intellectual cycles peak, respectively. The value d is the given date and may be smaller than any of p, e, or i. All values are non-negative and at most 365, and you may assume that a triple peak will occur within 21252 days of the given date. The end of input is indicated by a line in which p = e = i = d = -1. Output For each test case, print the case number followed by a message indicating the number of days to the next triple peak, in the form: Case 1: the next triple peak occurs in 1234 days. Use the plural form ``days'' even if the answer is 1. Sample Input 0 0 0 0 0 0 0 100 5 20 34 325 4 5 6 7 283 102 23 320 203 301 203 40 -1 -1 -1 -1 Sample Output Case 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 occurs in 8910 days. Case 6: the next triple peak occurs in 10789 days. Source East Central North America 1999 生理周期 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53539 Accepted: 15282 Description 人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。对于每个人,我们想知道何时三个高峰落在同一天。对于每个周期,我们会给出从当前年份的第一天开始,到出现高峰的天数(不一定是第一次高峰出现的时间)。你的任务是给定一个从当年第一天开始数的天数,输出从给定时间开始(不包括给定时间)下一次三个高峰落在同一天的时间(距给定时间的天数)。例如:给定时间为10,下次出现三个高峰同天的时间是12,则输出2(注意这里不是3)。 Input 输入四个整数: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 Input 0 0 0 0 0 0 0 100 5 20 34 325 4 5 6 7 283 102 23 320 203 301 203 40 -1 -1 -1 -1 Sample Output Case 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 occurs in 8910 days. Case 6: the next triple peak occurs in 10789 days. Source East Central North America 1999 Translator 北京大学程序设计实习2007, Xie Di

2009-06-01

poj 1005 I Think I Need a Houseboat

I Think I Need a Houseboat Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 41126 Accepted: 16537 Description Fred 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 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 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.) Input The first line of input will be a positive integer indicating how many data sets will be included (N). Each of the next N 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. Output For each data set, a single line of output should appear. This line should take the form 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.” Sample Input 2 1.0 1.0 25.0 0.0 Sample Output Property 1: This property will begin eroding in year 1. Property 2: This property will begin eroding in year 20. END OF OUTPUT. Hint 1.No property will appear exactly on the semicircle boundary: it will either be inside or outside. 2.This problem will be judged automatically. 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. Source Mid-Atlantic 2001

2009-06-01

poj 1004 Financial Management

Financial Management Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 49263 Accepted: 23921 Description Larry graduated this year and finally has a job. He's 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 what's been going on with his money. 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. Input The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included. Output The 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 by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output. Sample Input 100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75 Sample Output $1581.42 Source Mid-Atlantic 2001

2009-06-01

poj 1003 Hangover

Hangover Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 44187 Accepted: 20574 Description How 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. (We're assuming that the cards must be perpendicular 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 + ... + 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. Input The input consists of one or more test cases, 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. Output For each test case, output the minimum number of cards necessary to achieve an overhang of at least c card lengths. Use the exact output format shown in the examples. Sample Input 1.00 3.71 0.04 5.19 0.00 Sample Output 3 card(s) 61 card(s) 1 card(s) 273 card(s) Source Mid-Central USA 2001

2009-06-01

POJ 1002 487-3279 telephone numbers

487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102808 Accepted: 17241 Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialing the memorable TUT-GLOP. Sometimes only part of the number is used to spell a word. When you get back to your hotel tonight you can order a pizza from Gino's by dialing 310-GINO. Another way to make a telephone number memorable is to group the digits in a memorable way. You could order your pizza from Pizza Hut by calling their ``three tens'' number 3-10-10-10. The standard form of a telephone number is seven decimal digits with a hyphen between the third and fourth digits (e.g. 888-1200). The keypad of a phone supplies the mapping of letters to numbers, as follows: A, B, and C map to 2 D, E, and F map to 3 G, H, and I map to 4 J, K, and L map to 5 M, N, and O map to 6 P, R, and S map to 7 T, U, and V map to 8 W, X, and Y map to 9 There is no mapping for Q or Z. Hyphens are not dialed, and can be added and removed as necessary. The standard form of TUT-GLOP is 888-4567, the standard form of 310-GINO is 310-4466, and the standard form of 3-10-10-10 is 310-1010. Two telephone numbers are equivalent if they have the same standard form. (They dial the same number.) Your company is compiling a directory of telephone numbers from local businesses. As part of the quality control process you want to check that no two (or more) businesses in the directory have the same telephone number. Input The input will consist of one case. The first line of the input specifies the number of telephone numbers in the directory (up to 100,000) as a positive integer alone on the line. The remaining lines list the telephone numbers in the directory, with each number alone on a line. Each telephone number consists of a string composed of decimal digits, uppercase letters (excluding Q and Z) and hyphens. Exactly seven of the characters in the string will be digits or letters. Output Generate a line of output for each telephone number that appears more than once in any form. The line should give the telephone number in standard form, followed by a space, followed by the number of times the telephone number appears in the directory. Arrange the output lines by telephone number in ascending lexicographical order. If there are no duplicates in the input print the line: No duplicates. Sample Input 12 4873279 ITS-EASY 888-4567 3-10-10-10 888-GLOP TUT-GLOP 967-11-11 310-GINO F101010 888-1200 -4-8-7-3-2-7-9- 487-3279 Sample Output 310-1010 2 487-3279 4 888-4567 3 Source East Central North America 1999 487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102808 Accepted: 17241 Description 企业喜欢用容易被记住的电话号码。让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP。有时,只将电话号码中部分数字拼写成单词。当你晚上回到酒店,可以通过拨打310-GINO来向Gino's订一份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 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)。余下的每行是一个电话号码。每个电话号码由数字,大写字母(除了Q和Z)以及连接符组成。每个电话号码中只会刚好有7个数字或者字母。 Output 对于每个出现重复的号码产生一行输出,输出是号码的标准格式紧跟一个空格然后是它的重复次数。如果存在多个重复的号码,则按照号码的字典升序输出。如果输入数据中没有重复的号码,输出一行: No duplicates. Sample Input 12 4873279 ITS-EASY 888-4567 3-10-10-10 888-GLOP TUT-GLOP 967-11-11 310-GINO F101010 888-1200 -4-8-7-3-2-7-9- 487-3279 Sample Output 310-1010 2 487-3279 4 888-4567 3 Source East Central North America 1999 Translator 北京大学程序设计实习2007

2009-06-01

POJ 1008 Maya Calendar

Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28541 Accepted: 8643 Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day long year, called Haab, which had 19 months. Each of the first 18 months was 20 days long, and the names of the months were pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu. Instead of having names, the days of the months were denoted by numbers starting from 0 to 19. The last month of Haab was called uayet and had 5 days denoted by numbers 0, 1, 2, 3, 4. The Maya believed that this month was unlucky, the court of justice was not in session, the trade stopped, people did not even sweep the floor. For religious purposes, the Maya used another calendar in which the year was called Tzolkin (holly year). The year was divided into thirteen periods, each 20 days long. Each day was denoted by a pair consisting of a number and the name of the day. They used 20 names: imix, ik, akbal, kan, chicchan, cimi, manik, lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau and 13 numbers; both in cycles. Notice that each day has an unambiguous description. For example, at the beginning of the year the days were described as follows: 1 imix, 2 ik, 3 akbal, 4 kan, 5 chicchan, 6 cimi, 7 manik, 8 lamat, 9 muluk, 10 ok, 11 chuen, 12 eb, 13 ben, 1 ix, 2 mem, 3 cib, 4 caban, 5 eznab, 6 canac, 7 ahau, and again in the next period 8 imix, 9 ik, 10 akbal . . . Years (both Haab and Tzolkin) were denoted by numbers 0, 1, : : : , where the number 0 was the beginning of the world. Thus, the first day was: Haab: 0. pop 0 Tzolkin: 1 imix 0 Help professor M. A. Ya and write a program for him to convert the dates from the Haab calendar to the Tzolkin calendar. Input The date in Haab is given in the following format: NumberOfTheDay. Month Year The first line of the input file contains the number of the input dates in the file. The next n lines contain n dates in the Haab calendar format, each in separate line. The year is smaller then 5000. Output The date in Tzolkin should be in the following format: Number NameOfTheDay Year The first line of the output file contains the number of the output dates. In the next n lines, there are dates in the Tzolkin calendar format, in the order corresponding to the input dates. Sample Input 3 10. zac 0 0. pop 0 10. zac 1995 Sample Output 3 3 chuen 0 1 imix 0 9 cimi 2801

2009-04-04

poj 1001 Exponentiation

poj 1001 Exponentiation用字符串操作的

2008-11-12

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除