Codeforces 556 A Case of the Zeros and Ones
1 second
256 megabytes
standard input
standard output
Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.
Once he thought about a string of length n consisting of zeroes and ones. Consider the following operation: we choose any two adjacentpositions in the string, and if one them contains 0, and the other contains 1, then we are allowed to remove these two digits from the string, obtaining a string of length n - 2 as a result.
Now Andreid thinks about what is the minimum length of the string that can remain after applying the described operation several times (possibly, zero)? Help him to calculate this number.
First line of the input contains a single integer n (1 ≤ n ≤ 2·105), the length of the string that Andreid has.
The second line contains the string of length n consisting only from zeros and ones.
Output the minimum length of the string that may remain after applying the described operations several times.
41100
0
501010
1
811101111
6
In the first sample test it is possible to change the string like the following:
.
In the second sample test it is possible to change the string like the following:
.
In the third sample test it is possible to change the string like the following: 
水题
直接计算s中0和1的个数
然后相减即可
string s;
int a,b;
int main()
{
ios_base::sync_with_stdio();
int n;
cin>>n;
cin>>s;
;i<n;i++)
{
') a++;
else b++;
}
cout<<abs(a-b)<<endl;
;
}
#include<cmath>#include<math.h>#include<ctype.h>#include<algorithm>#include<bitset>#include<cassert>#include<cctype>#include<cerrno>#include<cfloat>#include<ciso646>#include<climits>#include<clocale>#include<complex>#include<csetjmp>#include<csignal>#include<cstdarg>#include<cstddef>#include<cstdio>#include<cstdlib>#include<cstring>#include<ctime>#include<cwchar>#include<cwctype>#include<deque>#include<exception>#include<fstream>#include<functional>#include<iomanip>#include<ios>#include<iosfwd>#include<iostream>#include<istream>#include<iterator>#include<limits>#include<list>#include<locale>#include<map>#include<memory>#include<new>#include<numeric>#include<ostream>#include<queue>#include<set>#include<sstream>#include<stack>#include<stdexcept>#include<streambuf>#include<string>#include<typeinfo>#include<utility>#include<valarray>#include<vector>#include<string.h>#include<stdlib.h>#include<stdio.h>using namespace std;#define havetxt 0#define shuru "input.txt"#define shuchu "output.txt"#define inf 0x7fffffff#define esp 1e-9#define pb push_back#define mp make_pairtypedef long long ll;
/**(""""******""""""><((\/!_,'.~--```-._!(<>"":::"><(\!'-````~..',_!/\())>"""""""("'\\\\\\\\\\\\\\\/_,^..-`` `~,/(>*"::{{{{{:"*>)\,~ ``-~^''_!\\\\\\':("""""""""""""*>)(\\!,'^~-``-^\>{;=???????????????????;}*\'-``-.^',!/\()>*""""({):::::::::::"*>)(\/_,^.~` ~_){=?????????=+}}}}};??????77?;{<_-``-.^'_!\()>*:::){):::::::::::">)(\!_'^~- -'){=7???????=}7o50Ssaeo7}?????????={)_- -.^'_!/()>*:{>{<{{{{{{{{{:"*<(\!_'^.``.\";?????????=radR#K@Am#ADs?;?????????={\^``.^',!\))>":<{<{{{{{{{{{:*<)\!_'^~` ^)}?7????????}+Z#FQRmBRqA@ABG={=7????????}<,``..'_!\(<*"<}>{{{{}{{{{"><(/_'^.-`')}????????;{ruxQFmqAQRAQFA#QmZ8j}?7???????;<,``~^'_!\)>*<}>}}}}}}}}:*<(\!,^.-`^)+7???????+[0XmBmqRmRRFAppKqqRNEFOr;????????;<^``.^,!\(<*)}*}}}}}}}{"><(/_'.- ~\{????????{zdA#FFmQFmdFFmmRqmRFppQ@Do}????????}\.`-.'_/\)>)+>}}}}}}}}">)\/_^.` ,>=???????{LR@qFNQmBmbXDGydkqmXQ#m@pKQz+???????=*_`-.^,!\)>(+*+++++++}">)\!,^~`-/:???????+nEmA#kPS2l1?;}{{};7ilu8xXA@QQe}??7????}\~`~.'!\)<\+*+++++++{*>)\!,^~ .(}7????7=?kNAg1})\\(()\]%z\)))(\\<;I4KMV}7??????;<'`-.'!\(>(+"++++;+;}*>)\!'^- ^<;7??????=k@NS_*}=??[[=;t7}r][r]7")("RMU;???????=>,`-.'!/(<(;";;;;;;;;">)\_'^- ^<;7??????}OAWO*]]ril]]l1/}vI1ltilzc*=Ab=?7??????=>,`-.'_/(>(=:======;=}><\!,^-`^)+???????=?x@s)?v1le1r}t(]1;[oor]I?<cRe}7???????;<^ -^,!\)>>={=========*)(!_^.`~\{????????;l0C)*>*><>:c[)+l=><<*><>)vS]=????????}(.`~^_!()*:={========;{)\_'.- .)}=;==;;;}c22\<<<<*>zt["=ju}>*****)55[=???????=*_--.'_\)>+{?{??????=rjl1r=;+{""{?1lllljllIJ&0]r[]r**}?[ci?=>*****>}az[????????}(.`-^_!\)}?{?{??????+3x0asU840U0YaS4ssaTaaaT4s0TTVS"*+7r3jrr}*****<32zi=??????;>'`-.'!\(:??}?}??????;vVvi7LzJlsCjj2CIu3&jcI&3[jO488*{?}]ci}==****)12ojo;?????;*_--.'_!({?7?}?}7777?7=3h&zJ5L22uOe2Os2sL5ne2anz3e4S4<<<>">:">>>><:Iuc}[3;????;>_-`.'_!(}r777+r}77777r=3f8SUS8ST888ST888S48SS88TUS48Tc];}{{{{{}?]1oI+[cj7??7?{(^`-.'_!>?r777r;7+7rrrr7=Jf0Y5u8aY5O4LuY40YS8sOL0OLOa8Ut]?r[rrr[7c3vI[i[r?=??}>!- ~^'_({r[rrrrr;r+rrrrrr=Jf0z1[Ouoi3ei=jsCvnati1Ovj1CS8><*>>>*)>>>(j*!<{=7j[(_.`-.^'/:?[r77rrrr;r+rrrrrr?z%SaLCL4&C50&CY8OT5O40eOsOYOfT***<]&L=>**:I` ^i{ `~.'\:7][rrrrrrrr;r;rrrr[[rc2z2CC22CCC22as4fCuv7r[31rr772:*">}tc?>"<1} >" ` c(-_)+r][r[[[r[rrrr=[=[[[[[[[r?7777777777=ntiIC=; ^{7( (j>***<<>*<?1`_2/"^ ` _I:rii[[[[[[[[[[[[[?]=]]]][[][][]][[[]]]]rjeJze1I~',..z* -~"i}>>>>*}r[\-/Jr} `` jji[[[[[[]]]]]]]]]?]=]]]]]]]]]][][]]]]]]]?JhV[*rej;\ ;" ^'^,>i[?=7+"*}- rs/^.-- cI[]]]]]]]]]]]]]]]?]=]]]]]]]]]]]]]]]]]]]]rI0a?\=l+};!>{ '1I]iO51+_\r?*>*>eoI[<-`3i[]]]]]]]]]]]]]]]?]?]]]]]]]]]]]]]]]]]]]i]I1,e[e+.;_){" -rneslr{}1i(!'. (_^+} "zr[ii]]]]]]]]]]]]]?i?iiiiiiiiiiiiiiiiiiii]jI ']r ?``i^ `<lnn[*+]]o ,:< ``^(elcci[[iiiiiiiiiiii717iiii111iiiii1iiiii]i1iz_ r];"/-=< >&0&uCv]!rr1*=35sav\ ^<?{+[n&nl[iiiiiiii11ir1r111111111iii11ollljI1[oov4OYOuC3!/UOvJ2uOaelj&OaLn3Js0c{ItuLOL5a01]1cjjllji1ir1r11111111111i1YsLL5&&unevnlv3CeLLeL2cjIIIoz5a08e3lIIIj2VeLse23ttl2Yzne&5558v]1r1r1111111111it&&CCnnu&5&5sIjIccjvCOVjljjjjjjIn82jIjlljj1Jh5tccIjjj3ae&euuC2uOJ][1r1111111111iOvcjcIIjlv2&StjljljIIluollIjljjlItjljlljjljj&jcjIjjjcL5zvlIjjIcvO]r1r1111111111[OvjljIllIIIjn3jlcj3jljclllulIlojjIjjojcostotljzol2Jlt2lvvovcjlI&21]1+rrrrrrrrr7?1uIilvi1zc11i1itz]JJ]ii11itniju1jIcIecce&CuC2s5cu5tztCzvuuzoe2L&v2I*/
//%%%%%%%%%%%%%%%%%%%//不薅羊毛不舒服斯基//不薅羊毛不舒服斯基//不薅羊毛不舒服斯基//orz_lzt_orz_lzt//orz_lzt_orz_lzt//orz_lzt_orz_lzt//洪荒之力洪荒之力//洪荒之力洪荒之力//洪荒之力洪荒之力//%%%%%%%%%%%%%%%%%%%
/*;;;;;;;;;;;;;;;;;;;;;;;;;+}:*>>><)(\\/!_,''^^.~-`` `^_()"{;????????????????????7==;yR9X@wQKl)**iVv"):+{:">))>><(*}7{:8o\\:[}.oT\:{*\){+:"(*<!{;_\^&bz<}*{}\3B#AM9}?=+177?????????????????7?=}:<\!'~``---..^'',_!!/\())<>*"::;;;;;;;;;;;;;;;;;;;;;;;;;;}:*>>><)(\\/!_,''^^.~-`` `^_()"{;?7???????????????????7=?$QkXmd@Fc!+IVr*<+}!!";+;?]ir=>)(}}0C>}))**YO)={=28Vfhf9T5CI+}!?';pf({}>\uBBNEs+?ii}?r?????????????????7?=}:<\!'~``---..^'',_!!/\())<<*"::;;;;;;;;;;;;;;;;;;;;;;;;==;{">>*<))\\/!!,,'^..---` `._\)*{;?7???????????????????;[;u@yDHNBRc_cu}>>\!(?3&4YXF98OfJ;\?>C4'}{>{\us)(i9Sv"_OBg}uu4hf&j+(;Ve<"<:uKwgMP=?7;?c;?????????????????7?;{"<\_^-``---.^''',_!!/\()<>*>:{{;;;;;;;;;;;;;;;;;;;;;;;;;;;}">**<<)(\/!!_,,^..---` `._\)*:;=?????????????????????:i{&WQR#@#l){)>>&Dw5=\,!,6A2jYOV4?)*e0\")":\au)\J0s4CrJS&]vv3vteVfU]\*)"?!hAdMyi"7r?=r????????????????????+{*)\_^- `---.^'',__!/\\()<>*>:++=====================;==;==+:*>><<)(\/!!_,,^..~--` `._\(*:+=?????????????????????r;?jyXQpgEO)*>*[4y$sO00Ua9$88&c]\)[(lU/}){"/83(*_}3zLT&&LYOa0&zr{({:"+><*<fBEp0+=r?==?r??????????????????=+:*)/,^- `---.^'',_!!/\\()<>>>{;;======================;=;==;{*>>><)(\/!!_,,'^.~~-` `.,/(>"+=?????????????????????1:r=hVFR9mL><<+;"<:7i11]c["":\!\**>)v8\+<{"/Ut)};>\!/*\=>*<)!,)"/)(<{"::)>V@FSa:[r=??=r???????????????????+:*(/,.` `-~~.^',,__/\\())<>>*}==========================;=?;}"*>><)(\/!!__,'^.~~-` `.,/(>"}=????????????????????+rr7;xvLB@Kc);*")>*"*>(!(\>")):+>?{("28/{>*"\ft<*:)*{\)7(\>*":"};"?)"}>*+:*gN8&S>]?7rr==??????????????????=}">(!'.` `-~~.^',,_!!\\())<>>"+==========================;=?=}"*>><)(\\/!__,'^.~~~` `.,/(>"}=????????????????????rr1{:azrpNKi\;}):;+>*;=:;)*={{=":(*{*vh(""):(Vt(}:}{*+}(*;:>)::)>";)>)"+<>{Zq3eu*i;[77==????????????????=?=}">(!'.` `-~~.^',,_!!\(())<>>{;?=========================+=?=}"*>><)((\//__,'^..~~```.,!\>"+=????????????????????=?[;7CS{USZC(!+{{<)":>>:>+:><>"<"<{*|ch>*{)})Ul/{)>>>}**>>\}:**:*{));<}>*)7V92st}c;[;??7????????????????=?=}">(!'.` `-~~^^',,_!!\(())>>>};?==============================}">><)(\\!!__,'^...~-``-^!()*{;???====??????????????=[7{lV+0vTj/}>***********"""***>+\ragL{}>>))hhTc)*{{<"<**************""*)]GVIhr???=====??????????????????={">\_'~``-~~~^'',_!//\\())<**}+;==============================+">><)((\!!__,'^...~-``-^_\)>:+???=?==????????????????7}IhrLCTl(:>**************""""\]geco!)>;:(=lSkz/=):""**************""*>igU]%=7???=?????????????????????;{*<\_'~``~~~.^'',_!//\(((<>*";;;==============================+{*><)((\/!!__'^^^.~-``-._\)>:+=???=???????????????=r=7}[xl3YSo)*"*********"*****:::{bc)*!:{(:">)*!Yx[{/?"<**************"">>lb0r%{77???????????????????????=;:*)/,^-`-~~~.^''__!/\(())<>*"==================================}**>))((/!!!_,'^^.~-```.,!(<"};???????????????????=];r;=fz]SS3*<:*********"**>>*""'UU~}{::)***}}?"!f4!>+<>**************""*\uXe1V{77??????????????????????==+"<(!'^-`-~~~.^',__!/\()<<<>"{?============================??==7={**>))(\///_,'^^^~--``-^'\(*{;=???????????????????r=r7}5O>ST&"):>***********"**>>JG;("c":{)(<\?i?>:%i>{>>***************"*(%d?O5+???=====????????????????=;{>(\_^-``-~~.^'',_!/\\()>>>*}==============================7?;=7={**><))(\\/!_'^^^~~-``-.'\(>:+=???==?????????????r;=??+24(0UY*)"*************""":?9]>Uhf?>(+)70kD;7%]);:(**************"">}9d"4e{7??==???????????????????;;{<(!,.-``~~~.''',_!/\\\)>>>";7;;=?=========================7?==r?}"*><))(\\/!_''^^~~-``-.^/(>:}=??===?????????????[}=;?;3U(YVa*<"*************":}+'$Y4S16s^:",hs70U4T!>>*{**************"")i%X)8e:77??????????????????????=+:<\!,.-``-~~.''',_!/\\\)>>*:;r+;=?=================???==??rr;r?+;?"*<))(((!!__,''''.~~-`~'!\)*{;=?=======??????????;r+?>u%!LUar)<<*""""""*")+**){)"+dw;_[w5?}f%:=}d9?))"*>********">"<:{\}_2Tg)9t}7????????????????===????;{">(_^-```-~.^^',__!/\(\)<<*+?======================???==??;}+rr??=+{*>))(\\\/!__,,^~~~-`-^_/)*}=?r77?????=????????==1[i"2S!Lssr/}}"""::""";>*<"<:(=!=[:;7[Ushu""<>{?)}+}*"**********">**<{\L9x(x3}7????????????????===???=+{*<\_.-```-~.^^,,_!!/\(()<>:;??====????????????????=???===?crr=;;=;+:>(\\!___,'^.~~^....-~^',/)*{+;7?==?==+========;+=}?"CU!OYUl\{>>*******(<>}}<{:*"">\)"\>?:"*=>;*{(>)\)}********>"*"<<{**8Gs\fz}7????????????????==???==}:>)/,.```--~.^',,_!!/())(<:;=??====????????????????????==??:>?+}}?==}>)<<(\///!!_,,,,__,'',!/(<*{}+7?==??=;========[?;}?+uU(C&Sv**)""""""""}?(::(*"):{*:{"""{\>_\;!}}**************>">{><;\?She\f3;7?????????????????=???=;{*<\!'~``--~.^^',_!!!\())(<}?==?????????????????????????????rj%6GGkPgG$9$66$99999999x%9%%%x%%%99$GGGPGGGPZPGGGGGGGGGGPPPZ%yphDdFg$xP99$$$$999T)>{":<}>>){:/?)<(>c})[)<">:+:)*********">{**+!v0YL\xt+7?????????????????????=+">(/,^-`---~.^^'__!!/\())(>+?==???????????????????????7??=??+cZG%h6x99%%9$66999$$66696G6$$$99999%%99%%%%%%%9%%%%%%%%fxx99Ufffxx%V%UGx%%%9%%%yw>"{{{>>*={}{=UTzCUO>}<"<})(>">********"">::":\a5n0(fv{7????????????????????=;}*<\_'.- ---~.^''__!//\()))";?===??????????????????????7??=?7?1PUO&0OOOYsssa0YYYsssasLOOL5LL5sssYYYYsOYssOLOsYYYYYYYY44s00s40L0LsOs5YYsssssssa6("<)><}+<(>\\7a6aOl(=<{/}:{*"{*********>"*":>}h320(Su:7????????????????????=;}>)/,^~` ---..^',__//\\()(*+;=??=??????????????????????77???7}]gx84fSa4SS88STSSSSSSSSSUU88STS888888SS8SUT408SSSSSSSSS8Ss888S00xsTS8US888SSSSSSD){"{:*<}/}Jzzi{.{CL988l\><*(<{*********>:<":)[91zO\0s:7????????????????????=;}<(!,.-` --~.^^''_!!/\\))({==;??????????????????????????????7+jySsOeOSVerCfS0sO5JaTvC8aT&h8szu2OTS88S8Oz5tvYSSS8a0Ct0S32TVsLV4Yea2Cs800444488Ug>""">*>\ox8ee25Y94j?[eG8[(}?>!***********{(}>Of<eO)Ls}??????====???=???====+{")(!'~```-~.^^',_!_!\)((>*}?r?;=????????????????????????????7;jk8843?ejccoeO0SsJ=z4j?ssa4L37Ie"t0&YassljOztc[cuST42IL8?IS0s4L8j:0vrV804444000fZ(*{{>>:&4l"<))rO5*|}*_7a9z(\+r********}*<:}{<%e,39<CT}[7?=?7?===??==???==?=+{*(\,.-``--~.^^',_!_!\(()*:+7r?=?7???????????????????????????7:1wT8TLzC:[J1tY88VV&LsoI0S0Yr*<Co;il=Is&"<t&lO5o*zTLj{;O17?1nUx03=?sJ{[&00444004hZ\>*<):&2?\)}:)>!(}>){>)\JGY"\>********"*>**(]Au"Cx/[y:[r?=????????????????;}">\_'~``-~-~.^^',_!/\(((>{+=?r7777???????????????????????????7;[kTe3lJ2}rj{ceLv[[vaO]?cnSsncr&i&32zoO2}"L5raT0?24YeI}1rO&?*[uYn]?t3o=lYa004488TP<:""7Jz{\"")>+*j}/*:}*?/)ii{"}********<>"{\>Yyx})%+;G[?77????7???????????=;{>(/_.-``~.~~^^'',!_/\(\)"+????777???????????????????????7????77rZT53r{0vcI=2O0Yi"IT0c[v208VL[Juujns&YOs=eO]5Y0}z80Ov?jrijj}[a4o1=2lvsvYa004488Ug*{*>+j);}>*+o8$Uxgu*{*(;+>":><""****"""<>;\j$]a0jb++82}=rr=;=r????????7?=;}")\/,.-`-~~~.^'',_!_/(((<{;7?==?7??????7777777777777777??7???7r}[wU0Su7Yj;r}3u40aJvseclV4aSau}L&rci]&4Vs=25ca40*2T&1}r0clivuL0nriI2]izOa0444004fg)**<()+,};!zg&i1=3xTj<*}>){>)+""****""{*>:(&%!rGGO*>Ss{;rr?;=7????77???=;}:>(!!'~``-~~..^''_!!!\(()*}=7?=?????7777777777777777777???77??7r?[kfsaC?v[io>zYYOTI}unr105SzV&7ozs=zLiOOac3ucO4a[uS8YJo4loce00fYOJIuoc3ua0444488Uw>))"*>{>>**":*:>{)>+<"})*}>*:)""****""*:>)5g/>"(){><?G7?=????=?????????;}">)\!.- `~.~.^'',_!/\())*+????77??7r7777777777777777777?7?7r7?7[=ckS083*&t=[?[[l40i7i;7{;+;La5?JSz}uSJC0a[cIt88sr2au[;v4ri3liOTt?====??r1n4S0088SZ**)""**""**""*><<>":::*><>***"">>":{:>)+(rX9u!+"")="1Ur?==77?;????777??;:>)\_,~-`-~..~^',!/!_,\(()}]i?????????7777777777777777777?7?7r7?7[+cbTs4Oz0l[&ncrC0Ll2uo2C11]LYLiuOj:nULa8s[1lnS0s1Csu]72V&c}[eSLj[I3n2or{[zs0aaaafZ\((>{**""*>**>:""*"*>>{">**><<*>*:>(>}+{{gCvdj(";(}/l6????????????7??=;}"<(!,^-``-~...'',_!/!!(\):=rrr????77777777777777777777777?7?7rr?7[+cbUs4SSsuuSU8sTU8OUUYUUas&848C8aClsUaSa8uOa08sVeY40YLs8aau&Ta5T88844aasCYSTSS84Tk(}{>:<*"*>>**>***"""*>{**""**")=}>}"(*{,VP[+3GI/:++)sO;?r7=;?r?????=;;{:>(/,^~````~...',,_!/\\((*=r==[7777rrrr777777777777777777777?7rr?7[=1wV0840aS8aaVSY488TaaVYUSa808LUS40U0OSY44U84Y&U0aa8UT0LsVSaVSYTaaaaa0040880a088Uw({>\{:>>****"*>>>*"""***>"""":?\<}){?<(0Gi=?{uGI*|/[P3+?r7==?[????==;}">)\_'~````-~.^^,___!!\((>}rr==r77777777777777777777777777777?7rr77[?ikV48aYS0aa0saaaaa0YaTOaaa0s8sUs0SSsaV8a80OSTY0884ass08s44a0S4Y48SST84044ass088Uk(}{"+:*******""*****><*****>>>"+{>*>)>YXj=}c[:tZ0rch9{==?????777??=;}:*<\!'.-```--~.^',_!!!!\\)}rr???=7777777777777777777777777777r77rr77[;1DVa4888s08V0SVU0aSS48S4aS808aS000aaSU0aU8sSU88888488SS4sSUYYTUS8assa8S88888884S6(**}"<:"*"">>***>***"****""**"{*\{?/"Ugj"i[7{r{luP9nr}????????77?==+:*<(!,^.-`--~~..^',_////()"?[7?rr=??????77rrrr7777777777777777r77rr77[;cDUs8SS8SUa4s0OS0a08aO88s80ssOsTS8a4SaasSS00sa8ass0TT0OUOO44080a08STTS844040asYVkr"\")**>>*">*""*>*":{{**"{:*":))=>!LXUI}?+i*]=?+;r}?];???????????=;{">(/_^.--`-~....',_!///(<*?7r77r7?777777rrrrrr7777777777777777r77rr77[=ckSsT8Y80TaSsSSsUUs4T4S8O88048Ss48a80sVS0Y8U8844ST8as4T0888SS0084444444800488ST8Q6U3j<*)()>"*"{+}:*""*""""">)()>;7ngG2[{ri?;?7;[?="[7;[?77??=???==;}:>(\!^.-```~.^^.^',_!///("}i7=r[??rrrrrrrrrrrrr77777777rrrrrrrrr77r7?7[=1yUs8444SS008840S8ST0sVsUTYs48400Y4T0a4a400880a4440488480aUsS804asha4SS4S4a88aaUk7ufgh5Jj7"(\())))<<<<<()))><:iz6GVO?{=i[7?====;?]1r};r???????=?=;}:*)\_'~```--...^^,_/!__/(>}?[[[r77?77777777777777777777777rrrrrrr77r7?7[=1yUs844TasSSssSTsY0088sS054SVa0a00448S044S8s4U8Saa88a0S8T4T08s480S8saU0a484S888hd>/=8%Y8SS4OntI????===;;?[lu0$Fw5;{}7c}+}};r[r=r=;;==?????????==;}{"<(!'.- ``--~.^^',_!\!!(*{;r[rrrrr777777777777777777777777rrrrr7r77rr7r]=1yUs884TTTS0YLOUaaS4aas40TusYf0Ts80L4Ta0a0ST848aST40S8aU00Saa00TYSSTOY8S08T84448Q8fv)\;"*<)<"};r[[[]]]]77;:*(\>j965ir{>}=r[?=?[=rr;}=77?????=;;{:*<(/_^-````~..^',__!!//\>{?r[[777rrrrrrrrrrrrrrrrr77777777rrrrrrrrr77rr7r]=1yUs884s3zaLcc58U8402zT2oc[l545sLOl1Y8uOS00TLnS4840a0885C482CS4OaSYv3vYOCus04S08qc?*::(::""*>>>)))<<<<<<>)(>>*+,*jV9UnOj?*>}r7;+r]r7rr=?777?=;+"*<(/_'.-` `-.^^^'__!!/\!){?77rr777rrr[[rrrrrrrrrrrrrrrrrrrrrr[[[[[rr77rr7r]=1yUs884&lluJ;+o20004lre&J1ula8V8z3r;Io3SVYLSLltT0aS8s4fcl0Li1a0Y45j[u3unjvLs08af6(>))*}>*:}}{"*****>>><<"::}:>*=*<*{xGesTULc{:;{}}=r]r;??7?=;}{>)(!_'.~````.^^^^',__!/\(:?r7777777rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr77rr7r]=1yUs8844LuCtr;7s808x42Cztv5lnOaatvI[7+tO040SSC;&s8S840s]v&I=}jof0uioYCuz13a8SU8fy:*)"{{>***""""""""""**{{<(>*"}*(>"(el.{=jLf%4e3c={"{=r??==;{"*(\!,'.~`-`-~.^^^^',__!\){=rr77r77rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr7r]=1yUs884J]rot][llL0n11C82oL2LOUu;]v;{[:+<ISSeaO+[LUsYTYj{c1>rri1SnC[I]=3?*i5Ys4sVG)**"""::"""***>>>*****<"**{:><"})<=0r```--':l5VVUazr{}===;}:>)\!,^.-` ---~^^^^,__!!\)>?r[77r[7rrrrrrrrrrrrrrrrrrrrrrrrrrrr77rrrrrrrrrr77r[=cDVs44042Iz[lJcvYT&j+?Yt?7rvSaIIuu1=c33l24O0silc;YV&SSJ:tt[IJzu0U8I]niuo+CY4fO4Vw)*">::>+><+{>"(""*}:)+<>""**":**}<;8/~~---``--^>ieU9Va1(=:\})!_'^~---``-.^^^^^,',!\){7rrrrrrrr777777rrrrrrrrrrrrrrrrrrrrrr77rrrrrrrrrr7rr[;iyTs440T&jOzoJ?3s8LaLoCjc;]1j0V0u]{?ijJL80TUi"05=[Sha8Vl2zvtlteU&v1?Lo5u;j80YSSUk(>><**"*>{"<"{}"*>/){(*****""":""\IS/-``````--`..`-)oa%5'"?./\'^~----`..^^^'',!,,\>:=rrrrrrrrr77777777rrrrrrrrrrrrrrrrrrrr77rrrrrrrrrrrr[[;1yUs8840u[utrJ]uSTs0ui21l"cj}z3]?>;227:sS0Ol;v802{cYLsL;1l1it&0Tz3L[v7CctruU5O0Vw)**>"*{)*{<<">>{*>"*<){">>*"""*{*_CO'-`````--- ~,^``~^cpo')!!..-```---...^^',_!_!)}?rrrrrrrrrrrr777777rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[]?cDUs400lc7lr+vlO&nYU3{JnC[2&e41:3Jc3JccL0si*3UOYTI(?ue77C&i=C0LeL4scJrj=0cra8aaVy)"">"*"*")<:::>"eTYt*":"*>*""*)}*!Ot`---``````'- `--``Ib{\-/-`` `-~~..^'''_!//){?[[rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[]=cyUY0aaC252c[7++=jsUj:n1+}?;2fn4Sl*iz1+84O1o0sSs4L7?e&oLTS3=7r"]ss=14C[l4z"1SfOUk)**<*>>:*(::}ev^VDj7:<*"""****>{)(Si`--`-````` `-~--~'`O6'-/`` `-...^,___,_!(>}?[][7rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[[[[rr[]=cyUs844V8xs55or>iLS43j4zrJz1eVSO4ucjj1lhL4saUOV8YUL2a088ss0ur}73aY[eUOzeTOrvSa0Tk)**>*>>"">+)+yv~nY\<*}>"::****{"/}f?^. ```----^.- `'~.^wi_^ ```-~.^^'_!_,'_!";[]][[rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[[[[rr[]=cDVs4444Y8OSUU0ss88Uf00TOUV8TaaS4OY84aSU5TUsTTa08T0sSS00aaf94OTTSS8V8YSsfS&VVLfTk)""*:"*<{*:)+6XfmXse])**"***"*{>(1S)^.````--~~ -` ` ~ rD' '----.^^^^,__,_(*=ri[rr[[[rrrr[[rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[[[rr[];ikSLsYOaasO4&8s0Y0OL4aLY4Yesa5saa044aYO4fsL40YaaSeOTaa5&UsCY8O5aLLsuOYsOeO8YLss8g(**>"**<+<):{z4L9GaxV::*>>*""*>>*vL -.--------~--- ~``! hv ----~.^^.'_!!/<}r[][?=r[[rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr][]][7[c[]yp%Zx$66666$$96666666666G66666Z%%9%6U9Vfx9ZUG996Gf6kxZPZZPPZP6k6PP6kkZZPPPPGPPyg(<<";)"**":>(/!-t0_0g,****""""})>43. ~- ^_.' -` `-' r9!`....^^'_\,^!"7r7rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr][[]r7[17rV6VG%$%%9999$$$$$$$$$$99999999VG$G%FEmFAwFZpkV%UxFL404T84484aYaxYxUsLsaaaaaaaay%}"*">>"""*)>;1T0kS)I4}"""*"****);Ti -`. ~1v -^ `~- `` ~ _x]-.'^.''^''_("=rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[[[[r7rii=[;"+;?}+++;;;;;;;;;;;;}}}}+++;;=?>181e%y0S&we^_!=U:`^.```--`._.`_-`^'--````---vL,*>*>}>"{"<)}[O5a[><[<"""*"***>)]U) ~-~~^5u `~ `` `-``-~`uU^`,^~_!'!_)}r[[r[rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr[[[[[[[[[[[[[[[[[[[[rr[]?7=r111iiii]][][]]]]]]]][[]]]]]i1[c?nh'!}CV9xwfi)(}L8~~.`-.^--(70..^.-`,------~~)x_=">*>***::>)()>*_}>*\***"*"""*(vs`'``-.`a?^-`^` `-`` ~-~~(y<`_'~_!_)";r]r7r][[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[*/
string s;int a,b;
int main(){ ios_base::sync_with_stdio(0);
int n;cin>>n;cin>>s;for(int i=0;i<n;i++){if(s[i]=='0') a++;else b++;}cout<<abs(a-b)<<endl;
return 0;}
Codeforces 556 A Case of the Zeros and Ones的更多相关文章
- Codeforces 556A:Case of the Zeros and Ones
A. Case of the Zeros and Ones time limit per test 1 second memory limit per test 256 megabytes input ...
- 【52.49%】【codeforces 556A】Case of the Zeros and Ones
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones 水题
A. Case of the Zeros and Ones Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/con ...
- 找规律/贪心 Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones
题目传送门 /* 找规律/贪心:ans = n - 01匹配的总数,水 */ #include <cstdio> #include <iostream> #include &l ...
- Case of the Zeros and Ones 分类: CF 2015-07-24 11:05 15人阅读 评论(0) 收藏
A. Case of the Zeros and Ones time limit per test 1 second memory limit per test 256 megabytes input ...
- A. Case of the Zeros and Ones----解题报告
A. Case of the Zeros and Ones Description Andrewid the Android is a galaxy-famous detective. In his ...
- Codeforces 556A Case of the Zeros and Ones(消除01)
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Andr ...
- CodeForces - 556A Case of the Zeros and Ones
//////////////////////////////////////////////////////////////////////////////////////////////////// ...
- CodeForces 556 --Case of Fake Numbers
B. Case of Fake Numbers time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
随机推荐
- SDS 链表
sds定义 struct sdshdr{ int len int free char buf[] } sds和c语言类似,仍然把字符串的末尾加上一个'.0',但是不会计入总长度,也就是不会对len造成 ...
- AngularJS数据双向绑定
<body ng-app> <div ng-controller="myCtrl"> <input ng-model="abc" ...
- Spring Boot框架的搭建
一.优点: 1.简化了配置,是基于Spring4的一套快速开发整合包,减少复杂度 而Spring MVC基于Spring 的一个MVC框架 2.会有一个statrter整合包,减少样板代码 3.自动配 ...
- winform利用委托delegate进行窗体间通信
前段时间学习委托,感觉很模糊的样子,也做过许多实例,但是项目中一直没有用到,今天在项目中遇到一个很简单的例子,现在拿出来,做一个简单的记录. 要求:将弹出框里勾选的内容返回到主面板上. 工具:委托. ...
- PHP源码阅读strtr
strtr 转换字符串中特定的字符,但是这个函数使用的方式多种. echo strtr('hello world', 'hw', 'ab'); // 第一种 aello borld echo strt ...
- 002.Create a web API with ASP.NET Core MVC and Visual Studio for Windows -- 【在windows上用vs与asp.net core mvc 创建一个 web api 程序】
Create a web API with ASP.NET Core MVC and Visual Studio for Windows 在windows上用vs与asp.net core mvc 创 ...
- es6的一些个人总结
es6的一些知识点 前言:es6(ECMAscript2015)标准 let.const.var的一些区别 let.const 块级作用域.全局作用域.函数作用域 var 全局作用域.函数作用域 变量 ...
- 【PHP】PHP面向对象编程--phpOOP入门
PHP从入门到精通 之PHP的面相对象编程 面向对象编程(Object Oriented Programming, OOP, 面向对象程序设计)是一种计算机编程架构,OOP的一条基本原则是计算机程序 ...
- JS - 讨论 - 编码习惯 - JavaScript代码到底要不要写分号?
如题:烦请大家在评论区给出原创意见!多谢!
- python+matplotlib+web.py
最近看了厦门大学数据库实验室林子雨老师的<大数据课程实验案例:网站用户行为分析>,可视化这块是用的R语言,我决定用Python来实现一下. 参考文献 http://dblab.xmu.ed ...