英语翻译1310.ACMDiagnosticsTimeLimit:0.5secondMemoryLimit:16MBHaveyoueverheardaboutACM?Maybe,maybe…Itisknowntobeanewprojectofcomputingmachinerylab.ACM(AbstractComputationMachine)—itisanewdeviceforquitecompl
英语翻译
1310.ACMDiagnosticsTimeLimit:0.5second
MemoryLimit:16MB
HaveyoueverheardaboutACM?Maybe,maybe…Itisknowntobeanewprojectofcomputingmachinerylab.ACM(AbstractComputationMachine)—itisanewdeviceforquitecomplexcomputations.Thereisonlyoneproblem:thepre-productionmodeldoesn'tworkproperly.So,thediagnosticsisnecessarytofindoutthereasonsofthedevicefaults.Therearesomenecessaryfactsknownabouttheinternalstructureofthedevice.ItconsistsofLindependentregisters.Eachoftheseregistersisabletostorethenumberintherangefrom1toM.Notallregistersareusedforcomputations—someofthemareusedfortheproposesoferrorcontrol.Thevaluesoftheseregistersarechoosinginsuchway,thatthesumofthevaluesofallregistersisdividedbygivennumberK.ThevaluesofallregistersofACMcompletelydefinethestateofdevice.Soforproposesofdiagnosticsitisenoughtoknowthevaluesofalltheseregisters.Theproblemisthatdeveloperswhocreatedthediagnosticsprocedurehaddecidedtooptimizethepresentationofdiagnosticsinformation.Soinsteadofsimplelistofregistervaluestheprocedurereturnsthesingleinteger—codeofthestate.Thiscodeshouldcompletelydescribethestateofdevice.That'swhydevelopersdecidedtocalculateitsuchway.Stateofdevice—isanarbitraryvectoroflengthL,satisfieddefinedabovedemands.Andthecodeofthestateisjustanindexofthisvectorinthelexicographicallyincreasinglistofallpossiblestates.(Notethatthefirststatehasindex0).It'seasytounderstandthatsuchvectorisreallycompletelydefinesastateoftheACM.Nowthedevicefaultsandoutputscodeofthestate.Theerrorcodehasbecomeuseful!Nowitisnecessarytoreconstructthevaluesofdeviceregistersfromthiscode.Asyouguessed—itisyourentry!InputThefirstlineofinputcontainsthreenumbersL,MandK(1≤L≤100;2≤M≤50;1≤K≤50)ThesecondlinecontainsanintegernumberN—errorcode,returnedbytheACMdevice.OutputYouaretowritetheprogramthatoutputsthevaluesofdeviceregisters,correspondingtothecodeN.I.e.Lintegernumbers,separatedbyspaces.Sampleinputoutput3104
213961