站标
O注册 登录O 忘了密码
丁酉(鸡)年四月三十 端午节 快到了,可 领取红包

Underhanded - missing luggag -- meokey

复 0 阅 3713 2010-01-04 14:06:22
2010-01-04 14:06:22
主题:2634920

meokey
头像乐善2724
声望4827
积分93438
从四品下:中大夫|明威将军
注册 : 2007-07-25 06:52:47
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
通宝推荐
棉妈论语别解(十六) 王小棉她妈/mezhan
棉妈论语别解(十七) 王小棉她妈/mezhan
斯坦营销 故乡在喀什/桥上
嘿嘿。 解甲/梓童
斯坦营销 故乡在喀什/镭射
我对海龟的意见是: 陈郢客/funseeker
有趣有益,互惠互利;开阔视野,博采众长。虚拟的网络,真实的人。天南地北客,相逢皆朋友
Copyright © cchere 西西河 RSS feed 帮助
2017年5月25日 周四 12点28分