亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

The Decoder - UVa458

系統 2344 0

歡迎訪問我的新博客: http://www.milkcu.com/blog/

原文地址: http://www.milkcu.com/blog/archives/uva458.html

題目描述



? The Decoder ?

Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character substitution based upon a? single arithmetic manipulation ?of the printable portion of the ASCII character set.

Input and Output

For example: with the input file that contains:

    1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
1KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5
  

your program should print the message:

    *CDC is the trademark of the Control Data Corporation.
*IBM is a trademark of the International Business Machine Corporation.
*DEC is the trademark of the Digital Equipment Corporation.
  

Your program should accept all sets of characters that use the same encoding scheme and should print the actual message of each set of characters.

Sample Input

    1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
1KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5
  

Sample Output

    *CDC is the trademark of the Control Data Corporation.
*IBM is a trademark of the International Business Machine Corporation.
*DEC is the trademark of the Digital Equipment Corporation.
  

解題思路

首先,編寫一個小程序,獲得解嗎規則。

    #include <stdio.h>
int main(void) {
	char s1[] = "1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5";
	char s2[] = "*CDC is the trademark of the Control Data Corporation.";
	int i = 0;
	while(s1[i] != '\0') {
		printf("%4d%4d\n", s1[i], s2[i]);
		i++;
	}
	return 0;
}
  

解碼規則是ASCII碼值減7。

代碼實現

    #include <stdio.h>
int main(void) {
	int c;
	while((c = getchar()) != EOF) {
		if(c == '\n') {
			putchar('\n');
		} else {
			putchar(c - 7);
		}
	}
	return 0;
}
  

(全文完)

The Decoder - UVa458


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 狠狠色噜噜狠狠狠狠 | 黄色福利在线观看 | 国产成人亚洲综合在线 | 四虎影视在线影院4hutv | 女人18毛片a级毛片免费看一 | 又爽又黄又无遮挡的视频在线观看 | 一区二区亚洲精品 | 国产成+人欧美+综合在线观看 | 亚洲色欲色欲www | 久久草精品视频 | 手机在线看片国产日韩生活片 | 色婷婷色99国产综合精品 | 91精品视频在线免费观看 | 114毛片免费观看网站 | 亚洲久草视频 | 亚洲酷色综合 | 国产成人精品一区二区三区 | 欧美亚洲一区二区三区在线 | 一级一级女人18毛片 | 亚洲最大在线视频 | 国产一区私人高清影院 | 国内精品久久久久久不卡影院 | 久久欧洲视频 | 福利视频在线播放 | 免费国产午夜高清在线视频 | 久色99| 在线亚洲欧美性天天影院 | 久久狠色噜噜狠狠狠狠97 | 日韩一及片 | 日韩一区三区 | 中文字幕视频不卡 | 天天操天天干天天操 | 国产天堂视频 | 一本一本久久a久久精品综合 | 国产一级一片免费播放 | 亚洲人成一区二区三区 | 99热久久这里就有精品 | 婷婷综合 在线 | 高清不卡一区二区三区 | 啪啪毛片 | 日韩 欧美 亚洲国产 |