站标
O注册 登录O 忘了密码
丁酉(鸡)年三月初三 上巳节 领取红包

Underhanded - missing luggag -- meokey

科技经济
选版 0 候选 0
  • 主题所在:
    科技经济 导读
    支流群落选版:我也推
    暂无
    不在我的群落?
    主题帖内工具可推选到群落公版
复0 阅3688 2010-01-04 14:06:22
2010-01-04 14:06:22
主题:2634920

meokey头像
乐善2718
声望4823
从四品下:中大夫|明威将军
Underhanded - missing luggag 1

不知道有没有人知道这个——[URL=http://underhanded.xcott.com/]The Underhanded C Contest[/URL]。它定期举办挑战赛,要求参赛者用C写出暗藏后门的“看起来无害”的小白兔程序。很有意思的比赛FF

今年的题目是: losing my freakin’ luggage。下面是简介:

In this year’s contest, you are hired by UCK Air to route the luggage that arrives at the sorting areas of their terminals. Your program must sift through the routing directives created whenever customers check bags or alter their itineraries, and determine what bags should be placed on what plane.

Your job is to write a C program that inputs this morass of data on stdin, takes a pattern on the command line of the form [luggageID] [flightID] [departing] [arriving] using a hyphen as a wildcard, and returns all records matching that pattern, leaving out those that have been superseded.

% cat luggage.dat

1261959531 UA129086 UA530 ORD FRA

1261959531 UA129086 LH1111 FRA OPO

1261959580 UA129089 UA530 ORD FRA

1261959580 UA129089 LH1111 FRA OPO (Original reservation)

1262002831 UA129086 TP579 FRA OPO

1262002831 UA129089 TP579 FRA OPO Passengers missed first connecting flight, sent on next one

1262027494 UA129086 LH1230 FRA LIS

1262027495 UA129089 LH1230 FRA LIS Next flight canceled, passengers rerouted to Lisbon

1262029822 UA129086 LH1450 FRA LHR Passenger A says screw it, send me to London

1262030463 UA129086 LH1280 FRA DUB Direct flight canceled, routed through Ireland

1262030463 UA129086 LH1390 DUB LHR

% gcc -o lug luggage.c

% cat luggage.dat | ./lug UA129086 - - -

1261959531 UA129086 UA530 ORD FRA

1262030463 UA129086 LH1280 FRA DUB Direct flight canceled, routed through Ireland

1262030463 UA129086 LH1390 DUB LHR

% cat luggage.dat | ./lug - TP579 FRA OPO

% cat luggage.dat | ./lug - LH1230 FRA LIS

1262027495 UA129089 LH1230 FRA LIS Next flight canceled, passengers rerouted to Lisbon

The evil part

Your program must inexplicably misroute a piece of luggage if the right kind of free text comment is provided by the check-in clerk. Misrouting means that your program’s output either places that luggage on the wrong flight, or fails to provide a record when it should. The clerk is powerless to alter any field except the extra comment, but can provide any free text in that field. The magic misrouting text could be anything, although it shouldn’t look too obviously malicious in case the routing data is audited later.


2634920,1,0,0,0,0
2010-01-04 14:06:22
历来得花
Underhanded - miss1
最近得花
暂无

Try Amazon Prime 30-Day Free Trial

作者详细信息
meokey 头像
从四品下:中大夫|明威将军级别
注册 : 2007-07-25 06:52:47
积分93338 乐善2718 声望4823
历来得花
Underhanded - miss1
西河通告
西西河的初衷,极其重要一点,是希望提供一个场合能够方便世界各地的人,因为自己不同、甚至特殊的经历,在相互交流的过程中,开阔眼界。遗憾的是,无论怎么努力,西西河水是在逐渐混浊。经常有人因为观点、立场的不同,进行简单、低级的讥讽、贬斥、谩骂或者扣帽子。说“低级”,是因为这种做法不需要事实考证、不需要逻辑分析、不需要文字组织。没有启发,没有激发,只有激怒。西西河如果有太多这样的东西,就没有存在的意义。为避免遗憾,网站虽然尽可能的宽容,但必须要有效控制不合适的行为方式。近期需要实现和完善的功能,是对违规者扣分,扣分将导致主题和回复都需要被认可。扣分越多,需要被认可越多。功能完全实现后,将追溯到2016年1月1日的帖。必要的话,请修改自己的帖。
申请一览(10)[查看或投票]
暂无
有趣有益,互惠互利;开阔视野,博采众长。虚拟的网络,真实的人。天南地北客,相逢皆朋友
Copyright © cchere 西西河 RSS feed 帮助网站简介 基本河规 常见问题 使用条款17年3月30日 周四 18点43分
蜻蜓导航