Problem 641 -- Do The Untwist
Tips
An interesting encrypt and decrypt problem.
The main difficulty is to un-mod a number.
For example:
x mod 4 = 2
x = 4*k + 2
If you know the valid range of x, you know the possible value(s) of k.
According to this rule, rewrite the encrypting equation into a decrypting one.
Input
5 cs. 101 thqqxw.lui.qswer 3 b_ylxmhzjsys.virpbkr 294 ndjykoiutkhqhpouirjajlftgcqatd.zqnbljcjiq 241 wdzknpbvdxsuxn_nlcqukgkyixuei..bunvftjd 185 igmykocldfwcgt_zptpi.ghyeccm_r.payvktrweuf 125 aduyewlettlchbaqxpjqaugpvwgheqrxdwbuc. 50 m.rbpwzzkftqht_tzkbjmvtesvjodhmqkovu_wr 181 t.izphcljf.vqburxskxplvsdvbbdzcojwvmatrwao 60 t.wbowsuzxtubfz_.sj.iptsdwupegmynwcue 61 enzayw.mherihnotdcjvmh.eihbbermsxymfdwzahr 81 ilzpowh.u_bzpavllcyr_gkjjuezesrb 183 dszyecwbk_dihfrmbkjjqmgxfufaudbvp_vhycjjpla 299 wmr_xinaqsvvypgvvb_a_gfdilboirqlw_bvea 128 idrexmchz.xhusnc.cybpykkdcnqt__ypivutnecb 289 tvztydemx.rdyf_rtkoaauziihdaosexkkvzosrv 13 t.fkaocatsjgfos_tey_wk.etsvb_rpkao.at.uv 166 tddlnovzhfjium.vkyefaofqscqle.sydwiwyseqc 55 c_ybxjvzykiqupdmcbpltgnfxqpdoscqdtfzz.rqxc 147 t_jlx_vgszequgfeqsjim.hwlhgfh.zfemhlawrw 247 tqyyxmvgysjzqvfm_bonl.fsekgasggfkwcaxezhcx 134 ajzlhj.uyfde_berdzsyiigmmebpm.aqoweuk 29 td.zxdeaysqlcgzqgkyihhujfhffdgzsjmh 184 eclqjzaqtsidubferkbitynqshceadccwi.xtxr 107 odzynwnuo_hepfupdssjivkyihjiempkziivlswqts 290 c_.qpo_olcwv.bdckwbihgftrejiaqcbawvzerd 200 edzkewbapiuqbbncukyaowztxwti_dfrxjhzaewxh 8 tszyapbzkdexx.ojuco_hyfwd_bgrd.bkxbp_stip 19 englx_vmltjphoarbpjwzusxhujfgn 142 i.fypmaugdevptdudpxamzufiuqapmqz.wb 32 s.gepqvmgieysafuqzriqukfhcgtfdddxghulsr 0
Output
cat this_is_a_secret beware._dogs_barking not_care_at_all_about_the_story_that_goes with_the_game._all_unnecessary_and_used items_are_left_behind_as_soon_as_possible. alone_in_the_dark_the_walkthrough_ver. most_things_that_do_not_need_to_be_done to_finish_the_game_are_marked_as_optional. this_is_by_no_means_the_only_order_of events_that_leads_to_a_completed_game._but it_is_nearly_the_most_efficient. distribute_this_freely_and_add_to_it_as_you wish_just_maintain_the_credits._enjoy. in_the_loft_push_the_wardrobe_in_front_of the_window_to_keep_out_the_winged_beast. then_push_the_chest_over_the_trapdoor_in the_floor_to_keep_out_the_zombie._now_you can_safely_search_the_loft._open_the_chest to_get_the_rifle._there_is_a_note_behind the_piano_on_its_right_hand_side._there_is a_book_in_the_small_bookcase_opposite the_window._read_and_leave_the_book extracts_of_golden_fleece_and_the_note. open_search_the_wardrobe_to_get_the_indian cover._take_the_lantern_from_the_table. exit_through_the_opening_in_the_corner_to the_right_of_the_barrels_the_same_way_you entered_into_the_storage_room. in_the_storage_room_open_search_the shelves_on_the_right_to_find_the_can_of