hdu(2016’12)- 网络同步赛

1001

真正的粉丝,不看题目都能A。

#include 
#include 
#include 

using namespace std;

int main(){
    int T;char st[1111];
    scanf("%d",&T);
    getchar();
    while(T--){
        gets(st);
        int len=strlen(st);
        if(st[len-1]=='?'){
            puts("-_-");
            continue;
        }
        if(st[len-1]=='.'){
            puts("Orz");
            continue;
        }
        if(st[len-1]=='!'){
            int cnt=0;
            for(int i=len-1;i;i--){
                if(st[i]=='!') cnt++;
            }
            putchar('W');
            for(int i=1;i<=cnt;i++) putchar('o');
            puts("w!");
        }
    }

    return 0;
} 

递增数

数位DP,卡了很久最后打表过了。。。

#include 
#include 
#include 

using namespace std;

int ans1[25000];

int ans2[25000]={6535,22222222,22222223,22222224,22222225,22222226,22222227,22222228,22222229,22222233,22222234,22222235,22222236,22222237,22222238,22222239,22222244,22222245,22222246,22222247,22222248,22222249,22222255,22222256,22222257,22222258,22222259,22222266,22222267,22222268,22222269,22222277,22222278,22222279,22222288,22222289,22222299,22222333,22222334,22222335,22222336,22222337,22222338,22222339,22222344,22222345,22222346,22222347,22222348,22222349,22222355,22222356,22222357,22222358,22222359,22222366,22222367,22222368,22222369,22222377,22222378,22222379,22222388,22222389,22222399,22222444,22222445,22222446,22222447,22222448,22222449,22222455,22222456,22222457,22222458,22222459,22222466,22222467,22222468,22222469,22222477,22222478,22222479,22222488,22222489,22222499,22222555,22222556,22222557,22222558,22222559,22222566,22222567,22222568,22222569,22222577,22222578,22222579,22222588,22222589,22222599,22222666,22222667,22222668,22222669,22222677,22222678,22222679,22222688,22222689,22222699,22222777,22222778,22222779,22222788,22222789,22222799,22222888,22222889,22222899,22222999,22223333,22223334,22223335,22223336,22223337,22223338,22223339,22223344,22223345,22223346,22223347,22223348,22223349,22223355,22223356,22223357,22223358,22223359,22223366,22223367,22223368,22223369,22223377,22223378,22223379,22223388,22223389,22223399,22223444,22223445,22223446,22223447,22223448,22223449,22223455,22223456,22223457,22223458,22223459,22223466,22223467,22223468,22223469,22223477,22223478,22223479,22223488,22223489,22223499,22223555,22223556,22223557,22223558,22223559,22223566,22223567,22223568,22223569,22223577,22223578,22223579,22223588,22223589,22223599,22223666,22223667,22223668,22223669,22223677,22223678,22223679,22223688,22223689,22223699,22223777,22223778,22223779,22223788,22223789,22223799,22223888,22223889,22223899,22223999,22224444,22224445,22224446,22224447,22224448,22224449,22224455,22224456,22224457,22224458,22224459,22224466,22224467,22224468,22224469,22224477,22224478,22224479,22224488,22224489,22224499,22224555,22224556,22224557,22224558,22224559,22224566,22224567,22224568,22224569,22224577,22224578,22224579,22224588,22224589,22224599,22224666,22224667,22224668,22224669,22224677,22224678,22224679,22224688,22224689,22224699,22224777,22224778,22224779,22224788,22224789,22224799,22224888,22224889,22224899,22224999,22225555,22225556,22225557,22225558,22225559,22225566,22225567,22225568,22225569,22225577,22225578,22225579,22225588,22225589,22225599,22225666,22225667,22225668,22225669,22225677,22225678,22225679,22225688,22225689,22225699,22225777,22225778,22225779,22225788,22225789,22225799,22225888,22225889,22225899,22225999,22226666,22226667,22226668,22226669,22226677,22226678,22226679,22226688,22226689,22226699,22226777,22226778,22226779,22226788,22226789,22226799,22226888,22226889,22226899,22226999,22227777,22227778,22227779,22227788,22227789,22227799,22227888,22227889,22227899,22227999,22228888,22228889,22228899,22228999,22229999,22233333,22233334,22233335,22233336,22233337,22233338,22233339,22233344,22233345,22233346,22233347,22233348,22233349,22233355,22233356,22233357,22233358,22233359,22233366,22233367,22233368,22233369,22233377,22233378,22233379,22233388,22233389,22233399,22233444,22233445,22233446,22233447,22233448,22233449,22233455,22233456,22233457,22233458,22233459,22233466,22233467,22233468,22233469,22233477,22233478,22233479,22233488,22233489,22233499,22233555,22233556,22233557,22233558,22233559,22233566,22233567,22233568,22233569,22233577,22233578,22233579,22233588,22233589,22233599,22233666,22233667,22233668,22233669,22233677,22233678,22233679,22233688,22233689,22233699,22233777,22233778,22233779,22233788,22233789,22233799,22233888,22233889,22233899,22233999,22234444,22234445,22234446,22234447,22234448,22234449,22234455,22234456,22234457,22234458,22234459,22234466,22234467,22234468,22234469,22234477,22234478,22234479,22234488,22234489,22234499,22234555,22234556,22234557,22234558,22234559,22234566,22234567,22234568,22234569,22234577,22234578,22234579,22234588,22234589,22234599,22234666,22234667,22234668,22234669,22234677,22234678,22234679,22234688,22234689,22234699,22234777,22234778,22234779,22234788,22234789,22234799,22234888,22234889,22234899,22234999,22235555,22235556,22235557,22235558,22235559,22235566,22235567,22235568,22235569,22235577,22235578,22235579,22235588,22235589,22235599,22235666,22235667,22235668,22235669,22235677,22235678,22235679,22235688,22235689,22235699,22235777,22235778,22235779,22235788,22235789,22235799,22235888,22235889,22235899,22235999,22236666,22236667,22236668,22236669,22236677,22236678,22236679,22236688,22236689,22236699,22236777,22236778,22236779,22236788,22236789,22236799,22236888,22236889,22236899,22236999,22237777,22237778,22237779,22237788,22237789,22237799,22237888,22237889,22237899,22237999,22238888,22238889,22238899,22238999,22239999,22244444,22244445,22244446,22244447,22244448,22244449,22244455,22244456,22244457,22244458,22244459,22244466,22244467,22244468,22244469,22244477,22244478,22244479,22244488,22244489,22244499,22244555,22244556,22244557,22244558,22244559,22244566,22244567,22244568,22244569,22244577,22244578,22244579,22244588,22244589,22244599,22244666,22244667,22244668,22244669,22244677,22244678,22244679,22244688,22244689,22244699,22244777,22244778,22244779,22244788,22244789,22244799,22244888,22244889,22244899,22244999,22245555,22245556,22245557,22245558,22245559,22245566,22245567,22245568,22245569,22245577,22245578,22245579,22245588,22245589,22245599,22245666,22245667,22245668,22245669,22245677,22245678,22245679,22245688,22245689,22245699,22245777,22245778,22245779,22245788,22245789,22245799,22245888,22245889,22245899,22245999,22246666,22246667,22246668,22246669,22246677,22246678,22246679,22246688,22246689,22246699,22246777,22246778,22246779,22246788,22246789,22246799,22246888,22246889,22246899,22246999,22247777,22247778,22247779,22247788,22247789,22247799,22247888,22247889,22247899,22247999,22248888,22248889,22248899,22248999,22249999,22255555,22255556,22255557,22255558,22255559,22255566,22255567,22255568,22255569,22255577,22255578,22255579,22255588,22255589,22255599,22255666,22255667,22255668,22255669,22255677,22255678,22255679,22255688,22255689,22255699,22255777,22255778,22255779,22255788,22255789,22255799,22255888,22255889,22255899,22255999,22256666,22256667,22256668,22256669,22256677,22256678,22256679,22256688,22256689,22256699,22256777,22256778,22256779,22256788,22256789,22256799,22256888,22256889,22256899,22256999,22257777,22257778,22257779,22257788,22257789,22257799,22257888,22257889,22257899,22257999,22258888,22258889,22258899,22258999,22259999,22266666,22266667,22266668,22266669,22266677,22266678,22266679,22266688,22266689,22266699,22266777,22266778,22266779,22266788,22266789,22266799,22266888,22266889,22266899,22266999,22267777,22267778,22267779,22267788,22267789,22267799,22267888,22267889,22267899,22267999,22268888,22268889,22268899,22268999,22269999,22277777,22277778,22277779,22277788,22277789,22277799,22277888,22277889,22277899,22277999,22278888,22278889,22278899,22278999,22279999,22288888,22288889,22288899,22288999,22289999,22299999,22333333,22333334,22333335,22333336,22333337,22333338,22333339,22333344,22333345,22333346,22333347,22333348,22333349,22333355,22333356,22333357,22333358,22333359,22333366,22333367,22333368,22333369,22333377,22333378,22333379,22333388,22333389,22333399,22333444,22333445,22333446,22333447,22333448,22333449,22333455,22333456,22333457,22333458,22333459,22333466,22333467,22333468,22333469,22333477,22333478,22333479,22333488,22333489,22333499,22333555,22333556,22333557,22333558,22333559,22333566,22333567,22333568,22333569,22333577,22333578,22333579,22333588,22333589,22333599,22333666,22333667,22333668,22333669,22333677,22333678,22333679,22333688,22333689,22333699,22333777,22333778,22333779,22333788,22333789,22333799,22333888,22333889,22333899,22333999,22334444,22334445,22334446,22334447,22334448,22334449,22334455,22334456,22334457,22334458,22334459,22334466,22334467,22334468,22334469,22334477,22334478,22334479,22334488,22334489,22334499,22334555,22334556,22334557,22334558,22334559,22334566,22334567,22334568,22334569,22334577,22334578,22334579,22334588,22334589,22334599,22334666,22334667,22334668,22334669,22334677,22334678,22334679,22334688,22334689,22334699,22334777,22334778,22334779,22334788,22334789,22334799,22334888,22334889,22334899,22334999,22335555,22335556,22335557,22335558,22335559,22335566,22335567,22335568,22335569,22335577,22335578,22335579,22335588,22335589,22335599,22335666,22335667,22335668,22335669,22335677,22335678,22335679,22335688,22335689,22335699,22335777,22335778,22335779,22335788,22335789,22335799,22335888,22335889,22335899,22335999,22336666,22336667,22336668,22336669,22336677,22336678,22336679,22336688,22336689,22336699,22336777,22336778,22336779,22336788,22336789,22336799,22336888,22336889,22336899,22336999,22337777,22337778,22337779,22337788,22337789,22337799,22337888,22337889,22337899,22337999,22338888,22338889,22338899,22338999,22339999,22344444,22344445,22344446,22344447,22344448,22344449,22344455,22344456,22344457,22344458,22344459,22344466,22344467,22344468,22344469,22344477,22344478,22344479,22344488,22344489,22344499,22344555,22344556,22344557,22344558,22344559,22344566,22344567,22344568,22344569,22344577,22344578,22344579,22344588,22344589,22344599,22344666,22344667,22344668,22344669,22344677,22344678,22344679,22344688,22344689,22344699,22344777,22344778,22344779,22344788,22344789,22344799,22344888,22344889,22344899,22344999,22345555,22345556,22345557,22345558,22345559,22345566,22345567,22345568,22345569,22345577,22345578,22345579,22345588,22345589,22345599,22345666,22345667,22345668,22345669,22345677,22345678,22345679,22345688,22345689,22345699,22345777,22345778,22345779,22345788,22345789,22345799,22345888,22345889,22345899,22345999,22346666,22346667,22346668,22346669,22346677,22346678,22346679,22346688,22346689,22346699,22346777,22346778,22346779,22346788,22346789,22346799,22346888,22346889,22346899,22346999,22347777,22347778,22347779,22347788,22347789,22347799,22347888,22347889,22347899,22347999,22348888,22348889,22348899,22348999,22349999,22355555,22355556,22355557,22355558,22355559,22355566,22355567,22355568,22355569,22355577,22355578,22355579,22355588,22355589,22355599,22355666,22355667,22355668,22355669,22355677,22355678,22355679,22355688,22355689,22355699,22355777,22355778,22355779,22355788,22355789,22355799,22355888,22355889,22355899,22355999,22356666,22356667,22356668,22356669,22356677,22356678,22356679,22356688,22356689,22356699,22356777,22356778,22356779,22356788,22356789,22356799,22356888,22356889,22356899,22356999,22357777,22357778,22357779,22357788,22357789,22357799,22357888,22357889,22357899,22357999,22358888,22358889,22358899,22358999,22359999,22366666,22366667,22366668,22366669,22366677,22366678,22366679,22366688,22366689,22366699,22366777,22366778,22366779,22366788,22366789,22366799,22366888,22366889,22366899,22366999,22367777,22367778,22367779,22367788,22367789,22367799,22367888,22367889,22367899,22367999,22368888,22368889,22368899,22368999,22369999,22377777,22377778,22377779,22377788,22377789,22377799,22377888,22377889,22377899,22377999,22378888,22378889,22378899,22378999,22379999,22388888,22388889,22388899,22388999,22389999,22399999,22444444,22444445,22444446,22444447,22444448,22444449,22444455,22444456,22444457,22444458,22444459,22444466,22444467,22444468,22444469,22444477,22444478,22444479,22444488,22444489,22444499,22444555,22444556,22444557,22444558,22444559,22444566,22444567,22444568,22444569,22444577,22444578,22444579,22444588,22444589,22444599,22444666,22444667,22444668,22444669,22444677,22444678,22444679,22444688,22444689,22444699,22444777,22444778,22444779,22444788,22444789,22444799,22444888,22444889,22444899,22444999,22445555,22445556,22445557,22445558,22445559,22445566,22445567,22445568,22445569,22445577,22445578,22445579,22445588,22445589,22445599,22445666,22445667,22445668,22445669,22445677,22445678,22445679,22445688,22445689,22445699,22445777,22445778,22445779,22445788,22445789,22445799,22445888,22445889,22445899,22445999,22446666,22446667,22446668,22446669,22446677,22446678,22446679,22446688,22446689,22446699,22446777,22446778,22446779,22446788,22446789,22446799,22446888,22446889,22446899,22446999,22447777,22447778,22447779,22447788,22447789,22447799,22447888,22447889,22447899,22447999,22448888,22448889,22448899,22448999,22449999,22455555,22455556,22455557,22455558,22455559,22455566,22455567,22455568,22455569,22455577,22455578,22455579,22455588,22455589,22455599,22455666,22455667,22455668,22455669,22455677,22455678,22455679,22455688,22455689,22455699,22455777,22455778,22455779,22455788,22455789,22455799,22455888,22455889,22455899,22455999,22456666,22456667,22456668,22456669,22456677,22456678,22456679,22456688,22456689,22456699,22456777,22456778,22456779,22456788,22456789,22456799,22456888,22456889,22456899,22456999,22457777,22457778,22457779,22457788,22457789,22457799,22457888,22457889,22457899,22457999,22458888,22458889,22458899,22458999,22459999,22466666,22466667,22466668,22466669,22466677,22466678,22466679,22466688,22466689,22466699,22466777,22466778,22466779,22466788,22466789,22466799,22466888,22466889,22466899,22466999,22467777,22467778,22467779,22467788,22467789,22467799,22467888,22467889,22467899,22467999,22468888,22468889,22468899,22468999,22469999,22477777,22477778,22477779,22477788,22477789,22477799,22477888,22477889,22477899,22477999,22478888,22478889,22478899,22478999,22479999,22488888,22488889,22488899,22488999,22489999,22499999,22555555,22555556,22555557,22555558,22555559,22555566,22555567,22555568,22555569,22555577,22555578,22555579,22555588,22555589,22555599,22555666,22555667,22555668,22555669,22555677,22555678,22555679,22555688,22555689,22555699,22555777,22555778,22555779,22555788,22555789,22555799,22555888,22555889,22555899,22555999,22556666,22556667,22556668,22556669,22556677,22556678,22556679,22556688,22556689,22556699,22556777,22556778,22556779,22556788,22556789,22556799,22556888,22556889,22556899,22556999,22557777,22557778,22557779,22557788,22557789,22557799,22557888,22557889,22557899,22557999,22558888,22558889,22558899,22558999,22559999,22566666,22566667,22566668,22566669,22566677,22566678,22566679,22566688,22566689,22566699,22566777,22566778,22566779,22566788,22566789,22566799,22566888,22566889,22566899,22566999,22567777,22567778,22567779,22567788,22567789,22567799,22567888,22567889,22567899,22567999,22568888,22568889,22568899,22568999,22569999,22577777,22577778,22577779,22577788,22577789,22577799,22577888,22577889,22577899,22577999,22578888,22578889,22578899,22578999,22579999,22588888,22588889,22588899,22588999,22589999,22599999,22666666,22666667,22666668,22666669,22666677,22666678,22666679,22666688,22666689,22666699,22666777,22666778,22666779,22666788,22666789,22666799,22666888,22666889,22666899,22666999,22667777,22667778,22667779,22667788,22667789,22667799,22667888,22667889,22667899,22667999,22668888,22668889,22668899,22668999,22669999,22677777,22677778,22677779,22677788,22677789,22677799,22677888,22677889,22677899,22677999,22678888,22678889,22678899,22678999,22679999,22688888,22688889,22688899,22688999,22689999,22699999,22777777,22777778,22777779,22777788,22777789,22777799,22777888,22777889,22777899,22777999,22778888,22778889,22778899,22778999,22779999,22788888,22788889,22788899,22788999,22789999,22799999,22888888,22888889,22888899,22888999,22889999,22899999,22999999,23333333,23333334,23333335,23333336,23333337,23333338,23333339,23333344,23333345,23333346,23333347,23333348,23333349,23333355,23333356,23333357,23333358,23333359,23333366,23333367,23333368,23333369,23333377,23333378,23333379,23333388,23333389,23333399,23333444,23333445,23333446,23333447,23333448,23333449,23333455,23333456,23333457,23333458,23333459,23333466,23333467,23333468,23333469,23333477,23333478,23333479,23333488,23333489,23333499,23333555,23333556,23333557,23333558,23333559,23333566,23333567,23333568,23333569,23333577,23333578,23333579,23333588,23333589,23333599,23333666,23333667,23333668,23333669,23333677,23333678,23333679,23333688,23333689,23333699,23333777,23333778,23333779,23333788,23333789,23333799,23333888,23333889,23333899,23333999,23334444,23334445,23334446,23334447,23334448,23334449,23334455,23334456,23334457,23334458,23334459,23334466,23334467,23334468,23334469,23334477,23334478,23334479,23334488,23334489,23334499,23334555,23334556,23334557,23334558,23334559,23334566,23334567,23334568,23334569,23334577,23334578,23334579,23334588,23334589,23334599,23334666,23334667,23334668,23334669,23334677,23334678,23334679,23334688,23334689,23334699,23334777,23334778,23334779,23334788,23334789,23334799,23334888,23334889,23334899,23334999,23335555,23335556,23335557,23335558,23335559,23335566,23335567,23335568,23335569,23335577,23335578,23335579,23335588,23335589,23335599,23335666,23335667,23335668,23335669,23335677,23335678,23335679,23335688,23335689,23335699,23335777,23335778,23335779,23335788,23335789,23335799,23335888,23335889,23335899,23335999,23336666,23336667,23336668,23336669,23336677,23336678,23336679,23336688,23336689,23336699,23336777,23336778,23336779,23336788,23336789,23336799,23336888,23336889,23336899,23336999,23337777,23337778,23337779,23337788,23337789,23337799,23337888,23337889,23337899,23337999,23338888,23338889,23338899,23338999,23339999,23344444,23344445,23344446,23344447,23344448,23344449,23344455,23344456,23344457,23344458,23344459,23344466,23344467,23344468,23344469,23344477,23344478,23344479,23344488,23344489,23344499,23344555,23344556,23344557,23344558,23344559,23344566,23344567,23344568,23344569,23344577,23344578,23344579,23344588,23344589,23344599,23344666,23344667,23344668,23344669,23344677,23344678,23344679,23344688,23344689,23344699,23344777,23344778,23344779,23344788,23344789,23344799,23344888,23344889,23344899,23344999,23345555,23345556,23345557,23345558,23345559,23345566,23345567,23345568,23345569,23345577,23345578,23345579,23345588,23345589,23345599,23345666,23345667,23345668,23345669,23345677,23345678,23345679,23345688,23345689,23345699,23345777,23345778,23345779,23345788,23345789,23345799,23345888,23345889,23345899,23345999,23346666,23346667,23346668,23346669,23346677,23346678,23346679,23346688,23346689,23346699,23346777,23346778,23346779,23346788,23346789,23346799,23346888,23346889,23346899,23346999,23347777,23347778,23347779,23347788,23347789,23347799,23347888,23347889,23347899,23347999,23348888,23348889,23348899,23348999,23349999,23355555,23355556,23355557,23355558,23355559,23355566,23355567,23355568,23355569,23355577,23355578,23355579,23355588,23355589,23355599,23355666,23355667,23355668,23355669,23355677,23355678,23355679,23355688,23355689,23355699,23355777,23355778,23355779,23355788,23355789,23355799,23355888,23355889,23355899,23355999,23356666,23356667,23356668,23356669,23356677,23356678,23356679,23356688,23356689,23356699,23356777,23356778,23356779,23356788,23356789,23356799,23356888,23356889,23356899,23356999,23357777,23357778,23357779,23357788,23357789,23357799,23357888,23357889,23357899,23357999,23358888,23358889,23358899,23358999,23359999,23366666,23366667,23366668,23366669,23366677,23366678,23366679,23366688,23366689,23366699,23366777,23366778,23366779,23366788,23366789,23366799,23366888,23366889,23366899,23366999,23367777,23367778,23367779,23367788,23367789,23367799,23367888,23367889,23367899,23367999,23368888,23368889,23368899,23368999,23369999,23377777,23377778,23377779,23377788,23377789,23377799,23377888,23377889,23377899,23377999,23378888,23378889,23378899,23378999,23379999,23388888,23388889,23388899,23388999,23389999,23399999,23444444,23444445,23444446,23444447,23444448,23444449,23444455,23444456,23444457,23444458,23444459,23444466,23444467,23444468,23444469,23444477,23444478,23444479,23444488,23444489,23444499,23444555,23444556,23444557,23444558,23444559,23444566,23444567,23444568,23444569,23444577,23444578,23444579,23444588,23444589,23444599,23444666,23444667,23444668,23444669,23444677,23444678,23444679,23444688,23444689,23444699,23444777,23444778,23444779,23444788,23444789,23444799,23444888,23444889,23444899,23444999,23445555,23445556,23445557,23445558,23445559,23445566,23445567,23445568,23445569,23445577,23445578,23445579,23445588,23445589,23445599,23445666,23445667,23445668,23445669,23445677,23445678,23445679,23445688,23445689,23445699,23445777,23445778,23445779,23445788,23445789,23445799,23445888,23445889,23445899,23445999,23446666,23446667,23446668,23446669,23446677,23446678,23446679,23446688,23446689,23446699,23446777,23446778,23446779,23446788,23446789,23446799,23446888,23446889,23446899,23446999,23447777,23447778,23447779,23447788,23447789,23447799,23447888,23447889,23447899,23447999,23448888,23448889,23448899,23448999,23449999,23455555,23455556,23455557,23455558,23455559,23455566,23455567,23455568,23455569,23455577,23455578,23455579,23455588,23455589,23455599,23455666,23455667,23455668,23455669,23455677,23455678,23455679,23455688,23455689,23455699,23455777,23455778,23455779,23455788,23455789,23455799,23455888,23455889,23455899,23455999,23456666,23456667,23456668,23456669,23456677,23456678,23456679,23456688,23456689,23456699,23456777,23456778,23456779,23456788,23456789,23456799,23456888,23456889,23456899,23456999,23457777,23457778,23457779,23457788,23457789,23457799,23457888,23457889,23457899,23457999,23458888,23458889,23458899,23458999,23459999,23466666,23466667,23466668,23466669,23466677,23466678,23466679,23466688,23466689,23466699,23466777,23466778,23466779,23466788,23466789,23466799,23466888,23466889,23466899,23466999,23467777,23467778,23467779,23467788,23467789,23467799,23467888,23467889,23467899,23467999,23468888,23468889,23468899,23468999,23469999,23477777,23477778,23477779,23477788,23477789,23477799,23477888,23477889,23477899,23477999,23478888,23478889,23478899,23478999,23479999,23488888,23488889,23488899,23488999,23489999,23499999,23555555,23555556,23555557,23555558,23555559,23555566,23555567,23555568,23555569,23555577,23555578,23555579,23555588,23555589,23555599,23555666,23555667,23555668,23555669,23555677,23555678,23555679,23555688,23555689,23555699,23555777,23555778,23555779,23555788,23555789,23555799,23555888,23555889,23555899,23555999,23556666,23556667,23556668,23556669,23556677,23556678,23556679,23556688,23556689,23556699,23556777,23556778,23556779,23556788,23556789,23556799,23556888,23556889,23556899,23556999,23557777,23557778,23557779,23557788,23557789,23557799,23557888,23557889,23557899,23557999,23558888,23558889,23558899,23558999,23559999,23566666,23566667,23566668,23566669,23566677,23566678,23566679,23566688,23566689,23566699,23566777,23566778,23566779,23566788,23566789,23566799,23566888,23566889,23566899,23566999,23567777,23567778,23567779,23567788,23567789,23567799,23567888,23567889,23567899,23567999,23568888,23568889,23568899,23568999,23569999,23577777,23577778,23577779,23577788,23577789,23577799,23577888,23577889,23577899,23577999,23578888,23578889,23578899,23578999,23579999,23588888,23588889,23588899,23588999,23589999,23599999,23666666,23666667,23666668,23666669,23666677,23666678,23666679,23666688,23666689,23666699,23666777,23666778,23666779,23666788,23666789,23666799,23666888,23666889,23666899,23666999,23667777,23667778,23667779,23667788,23667789,23667799,23667888,23667889,23667899,23667999,23668888,23668889,23668899,23668999,23669999,23677777,23677778,23677779,23677788,23677789,23677799,23677888,23677889,23677899,23677999,23678888,23678889,23678899,23678999,23679999,23688888,23688889,23688899,23688999,23689999,23699999,23777777,23777778,23777779,23777788,23777789,23777799,23777888,23777889,23777899,23777999,23778888,23778889,23778899,23778999,23779999,23788888,23788889,23788899,23788999,23789999,23799999,23888888,23888889,23888899,23888999,23889999,23899999,23999999,24444444,24444445,24444446,24444447,24444448,24444449,24444455,24444456,24444457,24444458,24444459,24444466,24444467,24444468,24444469,24444477,24444478,24444479,24444488,24444489,24444499,24444555,24444556,24444557,24444558,24444559,24444566,24444567,24444568,24444569,24444577,24444578,24444579,24444588,24444589,24444599,24444666,24444667,24444668,24444669,24444677,24444678,24444679,24444688,24444689,24444699,24444777,24444778,24444779,24444788,24444789,24444799,24444888,24444889,24444899,24444999,24445555,24445556,24445557,24445558,24445559,24445566,24445567,24445568,24445569,24445577,24445578,24445579,24445588,24445589,24445599,24445666,24445667,24445668,24445669,24445677,24445678,24445679,24445688,24445689,24445699,24445777,24445778,24445779,24445788,24445789,24445799,24445888,24445889,24445899,24445999,24446666,24446667,24446668,24446669,24446677,24446678,24446679,24446688,24446689,24446699,24446777,24446778,24446779,24446788,24446789,24446799,24446888,24446889,24446899,24446999,24447777,24447778,24447779,24447788,24447789,24447799,24447888,24447889,24447899,24447999,24448888,24448889,24448899,24448999,24449999,24455555,24455556,24455557,24455558,24455559,24455566,24455567,24455568,24455569,24455577,24455578,24455579,24455588,24455589,24455599,24455666,24455667,24455668,24455669,24455677,24455678,24455679,24455688,24455689,24455699,24455777,24455778,24455779,24455788,24455789,24455799,24455888,24455889,24455899,24455999,24456666,24456667,24456668,24456669,24456677,24456678,24456679,24456688,24456689,24456699,24456777,24456778,24456779,24456788,24456789,24456799,24456888,24456889,24456899,24456999,24457777,24457778,24457779,24457788,24457789,24457799,24457888,24457889,24457899,24457999,24458888,24458889,24458899,24458999,24459999,24466666,24466667,24466668,24466669,24466677,24466678,24466679,24466688,24466689,24466699,24466777,24466778,24466779,24466788,24466789,24466799,24466888,24466889,24466899,24466999,24467777,24467778,24467779,24467788,24467789,24467799,24467888,24467889,24467899,24467999,24468888,24468889,24468899,24468999,24469999,24477777,24477778,24477779,24477788,24477789,24477799,24477888,24477889,24477899,24477999,24478888,24478889,24478899,24478999,24479999,24488888,24488889,24488899,24488999,24489999,24499999,24555555,24555556,24555557,24555558,24555559,24555566,24555567,24555568,24555569,24555577,24555578,24555579,24555588,24555589,24555599,24555666,24555667,24555668,24555669,24555677,24555678,24555679,24555688,24555689,24555699,24555777,24555778,24555779,24555788,24555789,24555799,24555888,24555889,24555899,24555999,24556666,24556667,24556668,24556669,24556677,24556678,24556679,24556688,24556689,24556699,24556777,24556778,24556779,24556788,24556789,24556799,24556888,24556889,24556899,24556999,24557777,24557778,24557779,24557788,24557789,24557799,24557888,24557889,24557899,24557999,24558888,24558889,24558899,24558999,24559999,24566666,24566667,24566668,24566669,24566677,24566678,24566679,24566688,24566689,24566699,24566777,24566778,24566779,24566788,24566789,24566799,24566888,24566889,24566899,24566999,24567777,24567778,24567779,24567788,24567789,24567799,24567888,24567889,24567899,24567999,24568888,24568889,24568899,24568999,24569999,24577777,24577778,24577779,24577788,24577789,24577799,24577888,24577889,24577899,24577999,24578888,24578889,24578899,24578999,24579999,24588888,24588889,24588899,24588999,24589999,24599999,24666666,24666667,24666668,24666669,24666677,24666678,24666679,24666688,24666689,24666699,24666777,24666778,24666779,24666788,24666789,24666799,24666888,24666889,24666899,24666999,24667777,24667778,24667779,24667788,24667789,24667799,24667888,24667889,24667899,24667999,24668888,24668889,24668899,24668999,24669999,24677777,24677778,24677779,24677788,24677789,24677799,24677888,24677889,24677899,24677999,24678888,24678889,24678899,24678999,24679999,24688888,24688889,24688899,24688999,24689999,24699999,24777777,24777778,24777779,24777788,24777789,24777799,24777888,24777889,24777899,24777999,24778888,24778889,24778899,24778999,24779999,24788888,24788889,24788899,24788999,24789999,24799999,24888888,24888889,24888899,24888999,24889999,24899999,24999999,25555555,25555556,25555557,25555558,25555559,25555566,25555567,25555568,25555569,25555577,25555578,25555579,25555588,25555589,25555599,25555666,25555667,25555668,25555669,25555677,25555678,25555679,25555688,25555689,25555699,25555777,25555778,25555779,25555788,25555789,25555799,25555888,25555889,25555899,25555999,25556666,25556667,25556668,25556669,25556677,25556678,25556679,25556688,25556689,25556699,25556777,25556778,25556779,25556788,25556789,25556799,25556888,25556889,25556899,25556999,25557777,25557778,25557779,25557788,25557789,25557799,25557888,25557889,25557899,25557999,25558888,25558889,25558899,25558999,25559999,25566666,25566667,25566668,25566669,25566677,25566678,25566679,25566688,25566689,25566699,25566777,25566778,25566779,25566788,25566789,25566799,25566888,25566889,25566899,25566999,25567777,25567778,25567779,25567788,25567789,25567799,25567888,25567889,25567899,25567999,25568888,25568889,25568899,25568999,25569999,25577777,25577778,25577779,25577788,25577789,25577799,25577888,25577889,25577899,25577999,25578888,25578889,25578899,25578999,25579999,25588888,25588889,25588899,25588999,25589999,25599999,25666666,25666667,25666668,25666669,25666677,25666678,25666679,25666688,25666689,25666699,25666777,25666778,25666779,25666788,25666789,25666799,25666888,25666889,25666899,25666999,25667777,25667778,25667779,25667788,25667789,25667799,25667888,25667889,25667899,25667999,25668888,25668889,25668899,25668999,25669999,25677777,25677778,25677779,25677788,25677789,25677799,25677888,25677889,25677899,25677999,25678888,25678889,25678899,25678999,25679999,25688888,25688889,25688899,25688999,25689999,25699999,25777777,25777778,25777779,25777788,25777789,25777799,25777888,25777889,25777899,25777999,25778888,25778889,25778899,25778999,25779999,25788888,25788889,25788899,25788999,25789999,25799999,25888888,25888889,25888899,25888999,25889999,25899999,25999999,26666666,26666667,26666668,26666669,26666677,26666678,26666679,26666688,26666689,26666699,26666777,26666778,26666779,26666788,26666789,26666799,26666888,26666889,26666899,26666999,26667777,26667778,26667779,26667788,26667789,26667799,26667888,26667889,26667899,26667999,26668888,26668889,26668899,26668999,26669999,26677777,26677778,26677779,26677788,26677789,26677799,26677888,26677889,26677899,26677999,26678888,26678889,26678899,26678999,26679999,26688888,26688889,26688899,26688999,26689999,26699999,26777777,26777778,26777779,26777788,26777789,26777799,26777888,26777889,26777899,26777999,26778888,26778889,26778899,26778999,26779999,26788888,26788889,26788899,26788999,26789999,26799999,26888888,26888889,26888899,26888999,26889999,26899999,26999999,27777777,27777778,27777779,27777788,27777789,27777799,27777888,27777889,27777899,27777999,27778888,27778889,27778899,27778999,27779999,27788888,27788889,27788899,27788999,27789999,27799999,27888888,27888889,27888899,27888999,27889999,27899999,27999999,28888888,28888889,28888899,28888999,28889999,28899999,28999999,29999999,33333333,33333334,33333335,33333336,33333337,33333338,33333339,33333344,33333345,33333346,33333347,33333348,33333349,33333355,33333356,33333357,33333358,33333359,33333366,33333367,33333368,33333369,33333377,33333378,33333379,33333388,33333389,33333399,33333444,33333445,33333446,33333447,33333448,33333449,33333455,33333456,33333457,33333458,33333459,33333466,33333467,33333468,33333469,33333477,33333478,33333479,33333488,33333489,33333499,33333555,33333556,33333557,33333558,33333559,33333566,33333567,33333568,33333569,33333577,33333578,33333579,33333588,33333589,33333599,33333666,33333667,33333668,33333669,33333677,33333678,33333679,33333688,33333689,33333699,33333777,33333778,33333779,33333788,33333789,33333799,33333888,33333889,33333899,33333999,33334444,33334445,33334446,33334447,33334448,33334449,33334455,33334456,33334457,33334458,33334459,33334466,33334467,33334468,33334469,33334477,33334478,33334479,33334488,33334489,33334499,33334555,33334556,33334557,33334558,33334559,33334566,33334567,33334568,33334569,33334577,33334578,33334579,33334588,33334589,33334599,33334666,33334667,33334668,33334669,33334677,33334678,33334679,33334688,33334689,33334699,33334777,33334778,33334779,33334788,33334789,33334799,33334888,33334889,33334899,33334999,33335555,33335556,33335557,33335558,33335559,33335566,33335567,33335568,33335569,33335577,33335578,33335579,33335588,33335589,33335599,33335666,33335667,33335668,33335669,33335677,33335678,33335679,33335688,33335689,33335699,33335777,33335778,33335779,33335788,33335789,33335799,33335888,33335889,33335899,33335999,33336666,33336667,33336668,33336669,33336677,33336678,33336679,33336688,33336689,33336699,33336777,33336778,33336779,33336788,33336789,33336799,33336888,33336889,33336899,33336999,33337777,33337778,33337779,33337788,33337789,33337799,33337888,33337889,33337899,33337999,33338888,33338889,33338899,33338999,33339999,33344444,33344445,33344446,33344447,33344448,33344449,33344455,33344456,33344457,33344458,33344459,33344466,33344467,33344468,33344469,33344477,33344478,33344479,33344488,33344489,33344499,33344555,33344556,33344557,33344558,33344559,33344566,33344567,33344568,33344569,33344577,33344578,33344579,33344588,33344589,33344599,33344666,33344667,33344668,33344669,33344677,33344678,33344679,33344688,33344689,33344699,33344777,33344778,33344779,33344788,33344789,33344799,33344888,33344889,33344899,33344999,33345555,33345556,33345557,33345558,33345559,33345566,33345567,33345568,33345569,33345577,33345578,33345579,33345588,33345589,33345599,33345666,33345667,33345668,33345669,33345677,33345678,33345679,33345688,33345689,33345699,33345777,33345778,33345779,33345788,33345789,33345799,33345888,33345889,33345899,33345999,33346666,33346667,33346668,33346669,33346677,33346678,33346679,33346688,33346689,33346699,33346777,33346778,33346779,33346788,33346789,33346799,33346888,33346889,33346899,33346999,33347777,33347778,33347779,33347788,33347789,33347799,33347888,33347889,33347899,33347999,33348888,33348889,33348899,33348999,33349999,33355555,33355556,33355557,33355558,33355559,33355566,33355567,33355568,33355569,33355577,33355578,33355579,33355588,33355589,33355599,33355666,33355667,33355668,33355669,33355677,33355678,33355679,33355688,33355689,33355699,33355777,33355778,33355779,33355788,33355789,33355799,33355888,33355889,33355899,33355999,33356666,33356667,33356668,33356669,33356677,33356678,33356679,33356688,33356689,33356699,33356777,33356778,33356779,33356788,33356789,33356799,33356888,33356889,33356899,33356999,33357777,33357778,33357779,33357788,33357789,33357799,33357888,33357889,33357899,33357999,33358888,33358889,33358899,33358999,33359999,33366666,33366667,33366668,33366669,33366677,33366678,33366679,33366688,33366689,33366699,33366777,33366778,33366779,33366788,33366789,33366799,33366888,33366889,33366899,33366999,33367777,33367778,33367779,33367788,33367789,33367799,33367888,33367889,33367899,33367999,33368888,33368889,33368899,33368999,33369999,33377777,33377778,33377779,33377788,33377789,33377799,33377888,33377889,33377899,33377999,33378888,33378889,33378899,33378999,33379999,33388888,33388889,33388899,33388999,33389999,33399999,33444444,33444445,33444446,33444447,33444448,33444449,33444455,33444456,33444457,33444458,33444459,33444466,33444467,33444468,33444469,33444477,33444478,33444479,33444488,33444489,33444499,33444555,33444556,33444557,33444558,33444559,33444566,33444567,33444568,33444569,33444577,33444578,33444579,33444588,33444589,33444599,33444666,33444667,33444668,33444669,33444677,33444678,33444679,33444688,33444689,33444699,33444777,33444778,33444779,33444788,33444789,33444799,33444888,33444889,33444899,33444999,33445555,33445556,33445557,33445558,33445559,33445566,33445567,33445568,33445569,33445577,33445578,33445579,33445588,33445589,33445599,33445666,33445667,33445668,33445669,33445677,33445678,33445679,33445688,33445689,33445699,33445777,33445778,33445779,33445788,33445789,33445799,33445888,33445889,33445899,33445999,33446666,33446667,33446668,33446669,33446677,33446678,33446679,33446688,33446689,33446699,33446777,33446778,33446779,33446788,33446789,33446799,33446888,33446889,33446899,33446999,33447777,33447778,33447779,33447788,33447789,33447799,33447888,33447889,33447899,33447999,33448888,33448889,33448899,33448999,33449999,33455555,33455556,33455557,33455558,33455559,33455566,33455567,33455568,33455569,33455577,33455578,33455579,33455588,33455589,33455599,33455666,33455667,33455668,33455669,33455677,33455678,33455679,33455688,33455689,33455699,33455777,33455778,33455779,33455788,33455789,33455799,33455888,33455889,33455899,33455999,33456666,33456667,33456668,33456669,33456677,33456678,33456679,33456688,33456689,33456699,33456777,33456778,33456779,33456788,33456789,33456799,33456888,33456889,33456899,33456999,33457777,33457778,33457779,33457788,33457789,33457799,33457888,33457889,33457899,33457999,33458888,33458889,33458899,33458999,33459999,33466666,33466667,33466668,33466669,33466677,33466678,33466679,33466688,33466689,33466699,33466777,33466778,33466779,33466788,33466789,33466799,33466888,33466889,33466899,33466999,33467777,33467778,33467779,33467788,33467789,33467799,33467888,33467889,33467899,33467999,33468888,33468889,33468899,33468999,33469999,33477777,33477778,33477779,33477788,33477789,33477799,33477888,33477889,33477899,33477999,33478888,33478889,33478899,33478999,33479999,33488888,33488889,33488899,33488999,33489999,33499999,33555555,33555556,33555557,33555558,33555559,33555566,33555567,33555568,33555569,33555577,33555578,33555579,33555588,33555589,33555599,33555666,33555667,33555668,33555669,33555677,33555678,33555679,33555688,33555689,33555699,33555777,33555778,33555779,33555788,33555789,33555799,33555888,33555889,33555899,33555999,33556666,33556667,33556668,33556669,33556677,33556678,33556679,33556688,33556689,33556699,33556777,33556778,33556779,33556788,33556789,33556799,33556888,33556889,33556899,33556999,33557777,33557778,33557779,33557788,33557789,33557799,33557888,33557889,33557899,33557999,33558888,33558889,33558899,33558999,33559999,33566666,33566667,33566668,33566669,33566677,33566678,33566679,33566688,33566689,33566699,33566777,33566778,33566779,33566788,33566789,33566799,33566888,33566889,33566899,33566999,33567777,33567778,33567779,33567788,33567789,33567799,33567888,33567889,33567899,33567999,33568888,33568889,33568899,33568999,33569999,33577777,33577778,33577779,33577788,33577789,33577799,33577888,33577889,33577899,33577999,33578888,33578889,33578899,33578999,33579999,33588888,33588889,33588899,33588999,33589999,33599999,33666666,33666667,33666668,33666669,33666677,33666678,33666679,33666688,33666689,33666699,33666777,33666778,33666779,33666788,33666789,33666799,33666888,33666889,33666899,33666999,33667777,33667778,33667779,33667788,33667789,33667799,33667888,33667889,33667899,33667999,33668888,33668889,33668899,33668999,33669999,33677777,33677778,33677779,33677788,33677789,33677799,33677888,33677889,33677899,33677999,33678888,33678889,33678899,33678999,33679999,33688888,33688889,33688899,33688999,33689999,33699999,33777777,33777778,33777779,33777788,33777789,33777799,33777888,33777889,33777899,33777999,33778888,33778889,33778899,33778999,33779999,33788888,33788889,33788899,33788999,33789999,33799999,33888888,33888889,33888899,33888999,33889999,33899999,33999999,34444444,34444445,34444446,34444447,34444448,34444449,34444455,34444456,34444457,34444458,34444459,34444466,34444467,34444468,34444469,34444477,34444478,34444479,34444488,34444489,34444499,34444555,34444556,34444557,34444558,34444559,34444566,34444567,34444568,34444569,34444577,34444578,34444579,34444588,34444589,34444599,34444666,34444667,34444668,34444669,34444677,34444678,34444679,34444688,34444689,34444699,34444777,34444778,34444779,34444788,34444789,34444799,34444888,34444889,34444899,34444999,34445555,34445556,34445557,34445558,34445559,34445566,34445567,34445568,34445569,34445577,34445578,34445579,34445588,34445589,34445599,34445666,34445667,34445668,34445669,34445677,34445678,34445679,34445688,34445689,34445699,34445777,34445778,34445779,34445788,34445789,34445799,34445888,34445889,34445899,34445999,34446666,34446667,34446668,34446669,34446677,34446678,34446679,34446688,34446689,34446699,34446777,34446778,34446779,34446788,34446789,34446799,34446888,34446889,34446899,34446999,34447777,34447778,34447779,34447788,34447789,34447799,34447888,34447889,34447899,34447999,34448888,34448889,34448899,34448999,34449999,34455555,34455556,34455557,34455558,34455559,34455566,34455567,34455568,34455569,34455577,34455578,34455579,34455588,34455589,34455599,34455666,34455667,34455668,34455669,34455677,34455678,34455679,34455688,34455689,34455699,34455777,34455778,34455779,34455788,34455789,34455799,34455888,34455889,34455899,34455999,34456666,34456667,34456668,34456669,34456677,34456678,34456679,34456688,34456689,34456699,34456777,34456778,34456779,34456788,34456789,34456799,34456888,34456889,34456899,34456999,34457777,34457778,34457779,34457788,34457789,34457799,34457888,34457889,34457899,34457999,34458888,34458889,34458899,34458999,34459999,34466666,34466667,34466668,34466669,34466677,34466678,34466679,34466688,34466689,34466699,34466777,34466778,34466779,34466788,34466789,34466799,34466888,34466889,34466899,34466999,34467777,34467778,34467779,34467788,34467789,34467799,34467888,34467889,34467899,34467999,34468888,34468889,34468899,34468999,34469999,34477777,34477778,34477779,34477788,34477789,34477799,34477888,34477889,34477899,34477999,34478888,34478889,34478899,34478999,34479999,34488888,34488889,34488899,34488999,34489999,34499999,34555555,34555556,34555557,34555558,34555559,34555566,34555567,34555568,34555569,34555577,34555578,34555579,34555588,34555589,34555599,34555666,34555667,34555668,34555669,34555677,34555678,34555679,34555688,34555689,34555699,34555777,34555778,34555779,34555788,34555789,34555799,34555888,34555889,34555899,34555999,34556666,34556667,34556668,34556669,34556677,34556678,34556679,34556688,34556689,34556699,34556777,34556778,34556779,34556788,34556789,34556799,34556888,34556889,34556899,34556999,34557777,34557778,34557779,34557788,34557789,34557799,34557888,34557889,34557899,34557999,34558888,34558889,34558899,34558999,34559999,34566666,34566667,34566668,34566669,34566677,34566678,34566679,34566688,34566689,34566699,34566777,34566778,34566779,34566788,34566789,34566799,34566888,34566889,34566899,34566999,34567777,34567778,34567779,34567788,34567789,34567799,34567888,34567889,34567899,34567999,34568888,34568889,34568899,34568999,34569999,34577777,34577778,34577779,34577788,34577789,34577799,34577888,34577889,34577899,34577999,34578888,34578889,34578899,34578999,34579999,34588888,34588889,34588899,34588999,34589999,34599999,34666666,34666667,34666668,34666669,34666677,34666678,34666679,34666688,34666689,34666699,34666777,34666778,34666779,34666788,34666789,34666799,34666888,34666889,34666899,34666999,34667777,34667778,34667779,34667788,34667789,34667799,34667888,34667889,34667899,34667999,34668888,34668889,34668899,34668999,34669999,34677777,34677778,34677779,34677788,34677789,34677799,34677888,34677889,34677899,34677999,34678888,34678889,34678899,34678999,34679999,34688888,34688889,34688899,34688999,34689999,34699999,34777777,34777778,34777779,34777788,34777789,34777799,34777888,34777889,34777899,34777999,34778888,34778889,34778899,34778999,34779999,34788888,34788889,34788899,34788999,34789999,34799999,34888888,34888889,34888899,34888999,34889999,34899999,34999999,35555555,35555556,35555557,35555558,35555559,35555566,35555567,35555568,35555569,35555577,35555578,35555579,35555588,35555589,35555599,35555666,35555667,35555668,35555669,35555677,35555678,35555679,35555688,35555689,35555699,35555777,35555778,35555779,35555788,35555789,35555799,35555888,35555889,35555899,35555999,35556666,35556667,35556668,35556669,35556677,35556678,35556679,35556688,35556689,35556699,35556777,35556778,35556779,35556788,35556789,35556799,35556888,35556889,35556899,35556999,35557777,35557778,35557779,35557788,35557789,35557799,35557888,35557889,35557899,35557999,35558888,35558889,35558899,35558999,35559999,35566666,35566667,35566668,35566669,35566677,35566678,35566679,35566688,35566689,35566699,35566777,35566778,35566779,35566788,35566789,35566799,35566888,35566889,35566899,35566999,35567777,35567778,35567779,35567788,35567789,35567799,35567888,35567889,35567899,35567999,35568888,35568889,35568899,35568999,35569999,35577777,35577778,35577779,35577788,35577789,35577799,35577888,35577889,35577899,35577999,35578888,35578889,35578899,35578999,35579999,35588888,35588889,35588899,35588999,35589999,35599999,35666666,35666667,35666668,35666669,35666677,35666678,35666679,35666688,35666689,35666699,35666777,35666778,35666779,35666788,35666789,35666799,35666888,35666889,35666899,35666999,35667777,35667778,35667779,35667788,35667789,35667799,35667888,35667889,35667899,35667999,35668888,35668889,35668899,35668999,35669999,35677777,35677778,35677779,35677788,35677789,35677799,35677888,35677889,35677899,35677999,35678888,35678889,35678899,35678999,35679999,35688888,35688889,35688899,35688999,35689999,35699999,35777777,35777778,35777779,35777788,35777789,35777799,35777888,35777889,35777899,35777999,35778888,35778889,35778899,35778999,35779999,35788888,35788889,35788899,35788999,35789999,35799999,35888888,35888889,35888899,35888999,35889999,35899999,35999999,36666666,36666667,36666668,36666669,36666677,36666678,36666679,36666688,36666689,36666699,36666777,36666778,36666779,36666788,36666789,36666799,36666888,36666889,36666899,36666999,36667777,36667778,36667779,36667788,36667789,36667799,36667888,36667889,36667899,36667999,36668888,36668889,36668899,36668999,36669999,36677777,36677778,36677779,36677788,36677789,36677799,36677888,36677889,36677899,36677999,36678888,36678889,36678899,36678999,36679999,36688888,36688889,36688899,36688999,36689999,36699999,36777777,36777778,36777779,36777788,36777789,36777799,36777888,36777889,36777899,36777999,36778888,36778889,36778899,36778999,36779999,36788888,36788889,36788899,36788999,36789999,36799999,36888888,36888889,36888899,36888999,36889999,36899999,36999999,37777777,37777778,37777779,37777788,37777789,37777799,37777888,37777889,37777899,37777999,37778888,37778889,37778899,37778999,37779999,37788888,37788889,37788899,37788999,37789999,37799999,37888888,37888889,37888899,37888999,37889999,37899999,37999999,38888888,38888889,38888899,38888999,38889999,38899999,38999999,39999999,44444444,44444445,44444446,44444447,44444448,44444449,44444455,44444456,44444457,44444458,44444459,44444466,44444467,44444468,44444469,44444477,44444478,44444479,44444488,44444489,44444499,44444555,44444556,44444557,44444558,44444559,44444566,44444567,44444568,44444569,44444577,44444578,44444579,44444588,44444589,44444599,44444666,44444667,44444668,44444669,44444677,44444678,44444679,44444688,44444689,44444699,44444777,44444778,44444779,44444788,44444789,44444799,44444888,44444889,44444899,44444999,44445555,44445556,44445557,44445558,44445559,44445566,44445567,44445568,44445569,44445577,44445578,44445579,44445588,44445589,44445599,44445666,44445667,44445668,44445669,44445677,44445678,44445679,44445688,44445689,44445699,44445777,44445778,44445779,44445788,44445789,44445799,44445888,44445889,44445899,44445999,44446666,44446667,44446668,44446669,44446677,44446678,44446679,44446688,44446689,44446699,44446777,44446778,44446779,44446788,44446789,44446799,44446888,44446889,44446899,44446999,44447777,44447778,44447779,44447788,44447789,44447799,44447888,44447889,44447899,44447999,44448888,44448889,44448899,44448999,44449999,44455555,44455556,44455557,44455558,44455559,44455566,44455567,44455568,44455569,44455577,44455578,44455579,44455588,44455589,44455599,44455666,44455667,44455668,44455669,44455677,44455678,44455679,44455688,44455689,44455699,44455777,44455778,44455779,44455788,44455789,44455799,44455888,44455889,44455899,44455999,44456666,44456667,44456668,44456669,44456677,44456678,44456679,44456688,44456689,44456699,44456777,44456778,44456779,44456788,44456789,44456799,44456888,44456889,44456899,44456999,44457777,44457778,44457779,44457788,44457789,44457799,44457888,44457889,44457899,44457999,44458888,44458889,44458899,44458999,44459999,44466666,44466667,44466668,44466669,44466677,44466678,44466679,44466688,44466689,44466699,44466777,44466778,44466779,44466788,44466789,44466799,44466888,44466889,44466899,44466999,44467777,44467778,44467779,44467788,44467789,44467799,44467888,44467889,44467899,44467999,44468888,44468889,44468899,44468999,44469999,44477777,44477778,44477779,44477788,44477789,44477799,44477888,44477889,44477899,44477999,44478888,44478889,44478899,44478999,44479999,44488888,44488889,44488899,44488999,44489999,44499999,44555555,44555556,44555557,44555558,44555559,44555566,44555567,44555568,44555569,44555577,44555578,44555579,44555588,44555589,44555599,44555666,44555667,44555668,44555669,44555677,44555678,44555679,44555688,44555689,44555699,44555777,44555778,44555779,44555788,44555789,44555799,44555888,44555889,44555899,44555999,44556666,44556667,44556668,44556669,44556677,44556678,44556679,44556688,44556689,44556699,44556777,44556778,44556779,44556788,44556789,44556799,44556888,44556889,44556899,44556999,44557777,44557778,44557779,44557788,44557789,44557799,44557888,44557889,44557899,44557999,44558888,44558889,44558899,44558999,44559999,44566666,44566667,44566668,44566669,44566677,44566678,44566679,44566688,44566689,44566699,44566777,44566778,44566779,44566788,44566789,44566799,44566888,44566889,44566899,44566999,44567777,44567778,44567779,44567788,44567789,44567799,44567888,44567889,44567899,44567999,44568888,44568889,44568899,44568999,44569999,44577777,44577778,44577779,44577788,44577789,44577799,44577888,44577889,44577899,44577999,44578888,44578889,44578899,44578999,44579999,44588888,44588889,44588899,44588999,44589999,44599999,44666666,44666667,44666668,44666669,44666677,44666678,44666679,44666688,44666689,44666699,44666777,44666778,44666779,44666788,44666789,44666799,44666888,44666889,44666899,44666999,44667777,44667778,44667779,44667788,44667789,44667799,44667888,44667889,44667899,44667999,44668888,44668889,44668899,44668999,44669999,44677777,44677778,44677779,44677788,44677789,44677799,44677888,44677889,44677899,44677999,44678888,44678889,44678899,44678999,44679999,44688888,44688889,44688899,44688999,44689999,44699999,44777777,44777778,44777779,44777788,44777789,44777799,44777888,44777889,44777899,44777999,44778888,44778889,44778899,44778999,44779999,44788888,44788889,44788899,44788999,44789999,44799999,44888888,44888889,44888899,44888999,44889999,44899999,44999999,45555555,45555556,45555557,45555558,45555559,45555566,45555567,45555568,45555569,45555577,45555578,45555579,45555588,45555589,45555599,45555666,45555667,45555668,45555669,45555677,45555678,45555679,45555688,45555689,45555699,45555777,45555778,45555779,45555788,45555789,45555799,45555888,45555889,45555899,45555999,45556666,45556667,45556668,45556669,45556677,45556678,45556679,45556688,45556689,45556699,45556777,45556778,45556779,45556788,45556789,45556799,45556888,45556889,45556899,45556999,45557777,45557778,45557779,45557788,45557789,45557799,45557888,45557889,45557899,45557999,45558888,45558889,45558899,45558999,45559999,45566666,45566667,45566668,45566669,45566677,45566678,45566679,45566688,45566689,45566699,45566777,45566778,45566779,45566788,45566789,45566799,45566888,45566889,45566899,45566999,45567777,45567778,45567779,45567788,45567789,45567799,45567888,45567889,45567899,45567999,45568888,45568889,45568899,45568999,45569999,45577777,45577778,45577779,45577788,45577789,45577799,45577888,45577889,45577899,45577999,45578888,45578889,45578899,45578999,45579999,45588888,45588889,45588899,45588999,45589999,45599999,45666666,45666667,45666668,45666669,45666677,45666678,45666679,45666688,45666689,45666699,45666777,45666778,45666779,45666788,45666789,45666799,45666888,45666889,45666899,45666999,45667777,45667778,45667779,45667788,45667789,45667799,45667888,45667889,45667899,45667999,45668888,45668889,45668899,45668999,45669999,45677777,45677778,45677779,45677788,45677789,45677799,45677888,45677889,45677899,45677999,45678888,45678889,45678899,45678999,45679999,45688888,45688889,45688899,45688999,45689999,45699999,45777777,45777778,45777779,45777788,45777789,45777799,45777888,45777889,45777899,45777999,45778888,45778889,45778899,45778999,45779999,45788888,45788889,45788899,45788999,45789999,45799999,45888888,45888889,45888899,45888999,45889999,45899999,45999999,46666666,46666667,46666668,46666669,46666677,46666678,46666679,46666688,46666689,46666699,46666777,46666778,46666779,46666788,46666789,46666799,46666888,46666889,46666899,46666999,46667777,46667778,46667779,46667788,46667789,46667799,46667888,46667889,46667899,46667999,46668888,46668889,46668899,46668999,46669999,46677777,46677778,46677779,46677788,46677789,46677799,46677888,46677889,46677899,46677999,46678888,46678889,46678899,46678999,46679999,46688888,46688889,46688899,46688999,46689999,46699999,46777777,46777778,46777779,46777788,46777789,46777799,46777888,46777889,46777899,46777999,46778888,46778889,46778899,46778999,46779999,46788888,46788889,46788899,46788999,46789999,46799999,46888888,46888889,46888899,46888999,46889999,46899999,46999999,47777777,47777778,47777779,47777788,47777789,47777799,47777888,47777889,47777899,47777999,47778888,47778889,47778899,47778999,47779999,47788888,47788889,47788899,47788999,47789999,47799999,47888888,47888889,47888899,47888999,47889999,47899999,47999999,48888888,48888889,48888899,48888999,48889999,48899999,48999999,49999999,55555555,55555556,55555557,55555558,55555559,55555566,55555567,55555568,55555569,55555577,55555578,55555579,55555588,55555589,55555599,55555666,55555667,55555668,55555669,55555677,55555678,55555679,55555688,55555689,55555699,55555777,55555778,55555779,55555788,55555789,55555799,55555888,55555889,55555899,55555999,55556666,55556667,55556668,55556669,55556677,55556678,55556679,55556688,55556689,55556699,55556777,55556778,55556779,55556788,55556789,55556799,55556888,55556889,55556899,55556999,55557777,55557778,55557779,55557788,55557789,55557799,55557888,55557889,55557899,55557999,55558888,55558889,55558899,55558999,55559999,55566666,55566667,55566668,55566669,55566677,55566678,55566679,55566688,55566689,55566699,55566777,55566778,55566779,55566788,55566789,55566799,55566888,55566889,55566899,55566999,55567777,55567778,55567779,55567788,55567789,55567799,55567888,55567889,55567899,55567999,55568888,55568889,55568899,55568999,55569999,55577777,55577778,55577779,55577788,55577789,55577799,55577888,55577889,55577899,55577999,55578888,55578889,55578899,55578999,55579999,55588888,55588889,55588899,55588999,55589999,55599999,55666666,55666667,55666668,55666669,55666677,55666678,55666679,55666688,55666689,55666699,55666777,55666778,55666779,55666788,55666789,55666799,55666888,55666889,55666899,55666999,55667777,55667778,55667779,55667788,55667789,55667799,55667888,55667889,55667899,55667999,55668888,55668889,55668899,55668999,55669999,55677777,55677778,55677779,55677788,55677789,55677799,55677888,55677889,55677899,55677999,55678888,55678889,55678899,55678999,55679999,55688888,55688889,55688899,55688999,55689999,55699999,55777777,55777778,55777779,55777788,55777789,55777799,55777888,55777889,55777899,55777999,55778888,55778889,55778899,55778999,55779999,55788888,55788889,55788899,55788999,55789999,55799999,55888888,55888889,55888899,55888999,55889999,55899999,55999999,56666666,56666667,56666668,56666669,56666677,56666678,56666679,56666688,56666689,56666699,56666777,56666778,56666779,56666788,56666789,56666799,56666888,56666889,56666899,56666999,56667777,56667778,56667779,56667788,56667789,56667799,56667888,56667889,56667899,56667999,56668888,56668889,56668899,56668999,56669999,56677777,56677778,56677779,56677788,56677789,56677799,56677888,56677889,56677899,56677999,56678888,56678889,56678899,56678999,56679999,56688888,56688889,56688899,56688999,56689999,56699999,56777777,56777778,56777779,56777788,56777789,56777799,56777888,56777889,56777899,56777999,56778888,56778889,56778899,56778999,56779999,56788888,56788889,56788899,56788999,56789999,56799999,56888888,56888889,56888899,56888999,56889999,56899999,56999999,57777777,57777778,57777779,57777788,57777789,57777799,57777888,57777889,57777899,57777999,57778888,57778889,57778899,57778999,57779999,57788888,57788889,57788899,57788999,57789999,57799999,57888888,57888889,57888899,57888999,57889999,57899999,57999999,58888888,58888889,58888899,58888999,58889999,58899999,58999999,59999999,66666666,66666667,66666668,66666669,66666677,66666678,66666679,66666688,66666689,66666699,66666777,66666778,66666779,66666788,66666789,66666799,66666888,66666889,66666899,66666999,66667777,66667778,66667779,66667788,66667789,66667799,66667888,66667889,66667899,66667999,66668888,66668889,66668899,66668999,66669999,66677777,66677778,66677779,66677788,66677789,66677799,66677888,66677889,66677899,66677999,66678888,66678889,66678899,66678999,66679999,66688888,66688889,66688899,66688999,66689999,66699999,66777777,66777778,66777779,66777788,66777789,66777799,66777888,66777889,66777899,66777999,66778888,66778889,66778899,66778999,66779999,66788888,66788889,66788899,66788999,66789999,66799999,66888888,66888889,66888899,66888999,66889999,66899999,66999999,67777777,67777778,67777779,67777788,67777789,67777799,67777888,67777889,67777899,67777999,67778888,67778889,67778899,67778999,67779999,67788888,67788889,67788899,67788999,67789999,67799999,67888888,67888889,67888899,67888999,67889999,67899999,67999999,68888888,68888889,68888899,68888999,68889999,68899999,68999999,69999999,77777777,77777778,77777779,77777788,77777789,77777799,77777888,77777889,77777899,77777999,77778888,77778889,77778899,77778999,77779999,77788888,77788889,77788899,77788999,77789999,77799999,77888888,77888889,77888899,77888999,77889999,77899999,77999999,78888888,78888889,78888899,78888999,78889999,78899999,78999999,79999999,88888888,88888889,88888899,88888999,88889999,88899999,88999999,89999999,99999999,199999999};

int base[222];

bool isnum(int n){
    base[0]=0;
    while(n){
        base[++base[0]]=n%10;
        n/=10;
    }
    for(int i=base[0];i>=2;i--)
        if(base[i]>base[i-1]) return 0;
    return 1;
}

int main(){
    //freopen("outputans2.txt","w",stdout);
    for(int i=1;i<=20000000;i++){
        if(isnum(i)){
            ans1[++ans1[0]]=i;
        }
    }

    int T;
    cin>>T;
    while(T--){
        int x;
        scanf("%d",&x);
        int ansi = 0;
        for(int i=1;i<=ans1[0];i++){
            if(ans1[i]<=x) ansi++;
            if(ans1[i]>x) break;
        }
        for(int i=1;i<=ans2[0];i++){
            if(ans2[i]<=x) ansi++;
            if(ans2[i]>x) break;
        }
        printf("%d\n",ansi);
    }

    return 0;
}

1003

贪心吧,明显10件最优,处理一下边界情况就行了。。

#include 
#include 
#include 

using namespace std;

int solve(int k){
    int ans = k/10 * 4;
    int tmp = k%10;
    if(tmp==0) return ans;
    if(tmp<=3) ans+=2;
    else if(36) ans+=3;
    else ans+=4;
    return ans;
}

int main(){
    int T,n,m;
    cin>>T;
    while(T--){
        cin>>n>>m;
        int tmp1=m/3,tmp2=m%3;
        int ans = m/3 + solve(m%3 + n - m);

        if(tmp2){
            int ans2 = m/3+1 + solve(n-m);
            if(ans2for(int i=1;i<=10;i++){
            if(m/3-i<0) break;
            int t = (m/3 - i + solve(m%3 + 3*i + n - m));
            if(ans>t) ans = t;  
        }
        printf("%d\n",ans); 
    } 

    return 0;
} 

1004 我要拿走你的蜡烛

dfs一发就好了。

#include 
#include 
#include 
#include 
#include 

using namespace std;

string op[4]={"Fire","Ice","Dog","Evolved"};

int n,m;
bool flag;
map<string,int> mp;

bool dfs(int harm,int left,int buff){
    if(harm>=m){
        flag=1;
        return 0;
    }
    for(int i=0;i<=3;i++){
        if(mp[op[i]]){
            if(i==2&&left>=2){
                mp[op[i]]--;
                dfs(harm,left-2,buff+1);
                mp[op[i]]++;
            }
            if(i==3&&left>=4){
                mp[op[i]]--;
                dfs(harm,left-4,buff+2);
                mp[op[i]]++;
            }
            if(i==0&&left>=4){
                mp[op[i]]--;
                dfs(harm+buff+6,left-4,buff);
                mp[op[i]]++;
            }
            if(i==1&&left>=2){
                mp[op[i]]--;
                dfs(harm+buff+3,left-2,buff);
                mp[op[i]]++;
            }
        }
    }
}

int main(){
    mp.clear();
    int T;
    string st;
    cin>>T;
    while(T--){
        mp.clear();
        scanf("%d%d",&n,&m);
        for(int i=1;i<=n;i++){
            cin>>st;
            mp[st]++;
        }
        flag=0;
        dfs(0,10,0);
        if(flag){
            puts("Yes");
        }
        else{
            puts("No");
        }
    } 

    return 0;
} 

1005航海舰队

仍然做dfs吧,判重的时候出了点麻烦。如果以所有的地点去过作为结束条件会wa,考虑到会有两个状态组合起来是的这一次的格子全部被填过。所以最后的做法是判断某一点(左上角)即可。

#include 
#include 
#include 

using namespace std;

int n,m,top;
int g[55][55];
int ans[55][55];
bool v[55][55];
bool ansflag; 

const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1}; 

struct node{
    int x,y;
}info[25555];

bool comp(node a,node b){
    if(a.y==b.y) return a.xreturn a.yint dfs(){
    if(v[info[1].x][info[1].y]) return 0;

    v[info[1].x][info[1].y]=1; 

    for(int i=1;i<=top;i++) ans[info[i].x][info[i].y]=1;

    for(int i=0;i<4;i++){
        bool nostone = 1;
        for(int cnt=1;cnt<=top;cnt++){
            info[cnt].x+=dx[i];
            info[cnt].y+=dy[i];
            if(g[info[cnt].x][info[cnt].y]) nostone = 0;
            if(info[cnt].x>n||info[cnt].x<=0) nostone = 0;
            if(info[cnt].y>m||info[cnt].y<=0) nostone = 0;
        }
        if(!nostone){
            for(int cnt=1;cnt<=top;cnt++){
                info[cnt].x-=dx[i];
                info[cnt].y-=dy[i];
            }
            continue;
        }
        dfs();
        for(int cnt=1;cnt<=top;cnt++){
            info[cnt].x-=dx[i];
            info[cnt].y-=dy[i];
        }
    }
    v[info[1].x][info[1].y]=0;
}

int main(){
    freopen("input.txt","r",stdin);
    int T;
    scanf("%d",&T);getchar();
    for(int id=1;id<=T;id++){
        memset(g,0,sizeof(g));
        scanf("%d%d",&n,&m);getchar();
        top=0;
        for(int i=1;i<=n;i++){

            for(int j=1;j<=m;j++){
                char ch=getchar();
                if(ch=='.') g[i][j]=0;
                if(ch=='#') g[i][j]=1;
                if(ch=='o'){
                    top++;
                    info[top].x=i;
                    info[top].y=j;
                }
            }
            getchar();
        }

        memset(ans,0,sizeof(ans));
        memset(v,0,sizeof(v));

        dfs();

        int count = 0;
        for(int i=1;i<=n;i++)
            for(int j=1;j<=m;j++) {
                if(g[i][j]) continue;
                count += ans[i][j];
        } 
        printf("Case #%d: %d\n",id,count);
    }
    return 0;
}

1006最小路

大概是mst+lca吧。。。但不知道怎么就tle了。
交不了题目,码这边吧。留坑。

1007

水题。

#include 
#include 
#include 
#include 

using namespace std;

int a[2222];

int main(){
    int T,n;
    cin>>T;
    while(T--){
        scanf("%d",&n);
        for(int i=1;i<=n*2;i++) scanf("%d",a+i);
        sort(a+1,a+1+n+n);
        int ans=0;
        for(int i=n*2;i>=n+1;i--) ans+=(a[i]-a[2*n-i+1]);
        printf("%d\n",ans);
    } 
    return 0;
}

1008

公式加二分。

#include 
#include 
#include 
#include 
const double pi = 4.0 * atan(1.0);
int r,v1,v2,k;
int main(){
    int T;
    scanf("%d",&T);
    while (T--){
        scanf("%d%d%d%d",&r,&v1,&v2,&k);
        double left=k,right=2*pi*r,ans;
        double TMAX=right;
        while (left<=right){
            double mid=(left+right)/2;
            double f=TMAX-mid;
            if(f>=mid) f=mid;
            double angle=pi*(f/TMAX);
            double t = 2 * r * ( sin ( angle ) );
            if (((mid-k)/v1)<(t/v2)){
                left=mid+0.0001;
                ans=mid;
            }
            else right=mid-0.0001;
         }
        printf("%.0lf\n",right);
    }
    return 0;
}

你可能感兴趣的:(比赛,HDU)