- 1、本文档共12页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
华南理工大学第一届程序设计竞赛比赛试题
华南理工大学首届大学生程序设计竞赛SCUTCPC
试题
Problem A
IP Address
Submit file ipaddress.c / ipaddress.cpp Input file ipaddress.in Time limit 2 seconds Problem description
Suppose you are reading byte streams from any device, representing IP addresses. Your task is to convert a 32 characters long sequence of 1s and 0s (bits) to a dotted decimal format. A dotted decimal format for an IP address is form by grouping 8 bits at a time and converting the binary representation to decimal representation. Any 8 bits is a valid part of an IP address. To convert binary numbers to decimal numbers remember that both are positional numerical systems, where the first 8 positions of the binary systems are:
27 26 25 24 23 22 21 20 128 64 32 16 8 4 2 1
Input
You should read input data from the file of “ipaddress.in”.
The input will have a number N (1=N=9) in its first line representing the number of streams to convert. N lines will follow.
Output
Output your result to the standard output device.
The output must have N lines with a doted decimal IP address. A dotted decimal IP address is formed by grouping 8 bit at the time and converting the binary representation to decimal representation.
Sample Input
4
00000000000000000000000000000000
00000011100000001111111111111111
11001011100001001110010110000000
01010000000100000000000000000001
Sample Output
0.0.0.0
3.128.255.255
203.132.229.128
80.16.0.1
Problem B
The Greatest Common Divisor in Ancient Rome
Submit file roman.c / roman.cpp Input file roman.in Time limit 2 seconds Problem description
You must have retrieved the GCD (Greatest Common Divisor) of two positive integers before. Do you want to have a try, to do that in Ancient Rome Times?
The Ancient Roman, who lived hundreds of years ago, used a kind of symbols called “Roman numerals” for arithmetic.The following are 7 basic Roman numerals:
Roman numerals Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 These 7 symbols form all the other numbers. Al
文档评论(0)