Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
count=0 n=int(input()) number=str(input()) for i in range(n): if (number[i]=="8"): count+=1; if (n%11==0): if (n//11 > count): print(count); else: print(n//11) else: print("0")
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int n; std::cin >> n; if (n < 11) { std::cout << 0; return 0; } char *buf = new char; bool validNumber = false; std::cin >> buf; for (int x = 0; x < n; x++) { if (buf[x] == '8') { validNumber = true; } } if (!validNumber) { std::cout << 0; return 0; } double d; d = n / 11; d = trunc(d); std::cout << d; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt = 0; string s; cin >> n >> s; if (n % 11 == 0) { for (int i = 0; i < s.size(); i++) { if (s[i] == '8') cnt++; } if (cnt > 0) cout << (n / 11) << endl; else cout << "0" << endl; } else cout << "0" << endl; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int e8 = 0, oth = 0; for (int i = 0; i < n; i++) if (s[i] == '8') e8++; else oth++; if (n < 10) cout << 0 << endl; else if (e8 == n) cout << n / 11 << endl; else if ((oth / 10) >= e8) cout << e8 << endl; else { for (int i = e8; i >= 1; i--) if (((n - i) / 10) >= i) { cout << i << endl; break; } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python2
n=int (raw_input()) s=raw_input() c=s.count("8") t=n/11 if t<=c: print t else: print 0
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class PhoneNumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n; String ch=""; do{ System.out.println("n = "); n = sc.nextInt(); }while ((n<1)||(n>100)); do{ System.out.println("ch = "); ch = sc.next(); }while ((ch.length()!=n)||(ch.indexOf(" ")!=-1)||(!ch.matches("[0-9]+"))); if(ch.indexOf("8")==-1){ System.out.println(0); }else{ int numberOf8 = ch.length() - ch.replace("8", "").length(); if (numberOf8 <= ch.length() / 11){ System.out.println(numberOf8); } else{ System.out.println(ch.length() / 11); } } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
def phone_numbers(): n = int(input()) s = input() if (n // 11 == 0): print(0) return 0 k = 0 for i in range(0, n): if (s[i] == "8"): k += 1 if (k == n // 11): print(k) return 0 print(0) return 0 phone_numbers()
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public class InfinityGauntlet { public static void main(String[] args) { FastReader scan=new FastReader(); int n=scan.nextInt(); String str=scan.next(); int eight=0,notEight=0; for (int i = 0; i < n; i++) { if(str.charAt(i)=='8') eight++; else notEight++; } System.out.println(Math.max(Math.min(eight,notEight/10),eight-(10-notEight%10))); } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int f = 0; int n = 0; cin >> n; string s; cin >> s; int d = 0; if (s.size() < 8) cout << "0"; else for (int i = 0; i < n; i++) { if (s[i] == '8') f++; } if (f == 0) cout << "0"; else if (f != 0) { d = n / 8; if (d == f) cout << f; else if (d < f) cout << d; } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) s = input() counter = 0 for c in s: if c == '8': counter += 1 print(min(n // 8, counter))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class PhoneNumbers_1060A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); s.nextLine(); String line = s.nextLine(); int count = 0; for (int i = 0; i < line.length(); i++) { if(line.charAt(i)=='8') count++; } if(n>=11 && count>= n/11){ System.out.println(n/11); } else { System.out.println(0); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] # def LF(): return [float(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def LS(): return sys.stdin.readline().split() def S(): return input() def main(): n=I() l=list(S()) x=n//8 y=l.count('8') return min(x,y) # main() print(main())
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python2
n=input() s=raw_input() i=0 f=0 while i<n: if s[i]=='8': f+=1 i+=1 if n<11 or f==0: print 0 if n>=11 and f>=n/11: print n/11
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); String v = s.next(); int[] numeros = new int[v.length()]; for (int i = 0; i < numeros.length; i++) { numeros[i] = Integer.parseInt(v.charAt(i) + ""); } int nn = (int) N / 11; int q = 0; for (int num : numeros) { if (num == 8) { q++; } } if (q >= nn) { System.out.println(nn); } else if(q > 0) { System.out.println(q); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
u=int(input()) d=[] s=0 arr=list(map(int,input())) #print(arr) try: if len(arr)>=11 and 8 in arr: count=arr.count(8) print(count) for u in range(count): if 8 in arr: s=s+1 arr[arr.index(8)]=-1 d.append(8) for i in range(0,10): if i in arr: d.append(i) arr[arr.index(i)]=-1 except: pass print(s)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) s = input() c = 0 for i in range(s.count('8')): n -= 10 if n < 0: break c += 1 print(c)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; import java.io.*; public class CF{ public static void main(String arg[]) throws IOException{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); int a = 0, b = 0; for(int i=0;i<n;i++){ if(s.charAt(i)=='8') a++; else b++; } System.out.println(Math.min(a, b/9)); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int len; scanf("%d ", &len); char cln[len]; gets(cln); int dig = 0; for (int l = 0; l < len; l++) { if (cln[l] == '8') dig++; } int ll = strlen(cln) / 11; if (dig < ll) { if (dig == 0) printf("0\n"); else { ll = fabs(ll - dig); printf("%d\n", ll); } } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18 + 123; const long double EPS = 1e-9; const int MX = 1e9 + 1; const int inf = 1e9 + 123; const int MOD = 1e9 + 7; const int N = 1e5 + 123; const int dx[] = {0, 0, 1, -1}; const int dy[] = {1, -1, 0, 0}; int main() { int n, ans = 0; cin >> n; string s; cin >> s; for (int i = 0; i < n; ++i) { if (n % 11 == 0) { if (s[i] == '8') { ans++; } } } if (ans == 0) { cout << 0; return 0; } if (ans >= n / 11) { cout << n / 11; return 0; } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner;import java.util.Arrays; public class Phone { public static void main(String[] args) { Scanner scanner = new Scanner (System.in); int n = scanner.nextInt(); String s = scanner.next(); int d=0; for (int i=0;i<n;i++) { if (s.charAt(i)=='8') d++; } int [] a;a=new int [n]; for (int i=n-d;i<n;i++) { a[i]=i/10; } Arrays.sort(a); System.out.println(a[n-1]); scanner.close(); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; import java.io.*; public class A1060 { public static void main(String[] args) throws Exception { int n = i(); String s = s(); int eight = 0; int other = 0; for (int i = 0; i < n; i++) { if (s.charAt(i) == '8') eight++; else other++; } out.println(Math.min(eight, other / 10)); out.close(); } static BufferedReader in; static StringTokenizer st = new StringTokenizer(""); static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); static { try { in = new BufferedReader(new FileReader("cf.in")); } catch (Exception e) { in = new BufferedReader(new InputStreamReader(System.in)); } } static void check() throws Exception { while (!st.hasMoreTokens()) st = new StringTokenizer(in.readLine()); } static int i() throws Exception {check(); return Integer.parseInt(st.nextToken());} static String s() throws Exception {check(); return st.nextToken();} static double d() throws Exception {check(); return Double.parseDouble(st.nextToken());} static long l() throws Exception {check(); return Long.parseLong(st.nextToken());} }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=input() c=input() eig_d=c.count('8') if eig_d==0 or int(n)<8 : print(0) else : print(min(eig_d,int(n) // 8))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String str = sc.nextLine(); int count = 0; str = sc.nextLine(); for(int i = 0; i < n; i++) { if(str.charAt(i) == '8') { count++; } } int div = n / 11; int mod = n % 11; System.out.println(div + "," + mod + "," + count); if(mod != 0) { System.out.println(0); } else if(count < div) { System.out.println(0); } else { System.out.println(div); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=int(input()) s=input() x=len(s) c=0 for i in range(x): if s[i]=='8': c=c+1 if c>int(n/11): print(n/11)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) l = input() a = len(l)%11 p = len(l)-a for i in range(p): if l.count("8")>=p//11: print(p//11) break elif l.count("8")<p//11: print(l.count("8")) break else:print(0) break
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
u=int(input()) d=[] s=0 arr=list(map(int,input())) print(arr) try: if len(arr)>=11 and 8 in arr: count=arr.count(8) print(count) for u in range(count): if 8 in arr: s=s+1 arr[arr.index(8)]=-1 d.append(8) for i in range(0,10): if i in arr: d.append(i) arr[arr.index(i)]=-1 except: pass print(s)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner in = new FastScanner(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskB solver = new TaskB(); solver.solve(1, in, out); out.close(); } static class TaskB { public void solve(int testNumber, FastScanner in, PrintWriter out) { long n = in.nextLong(); int[] d = digits(n); int ans = 0; for (int i = 0; i + 1 < d.length; i++) { ans += 9; if (d[i] != 9) { ans += (d[i] + 1) % 10; --d[i + 1]; } } ans += d[d.length - 1]; out.println(ans); } private int[] digits(long n) { int[] d = new int[100]; int k = 0; while (n > 0) { d[k++] = (int) (n % 10); n /= 10; } return Arrays.copyOf(d, k); } } static class FastScanner { private BufferedReader in; private StringTokenizer st; public FastScanner(InputStream stream) { in = new BufferedReader(new InputStreamReader(stream)); } public String next() { while (st == null || !st.hasMoreTokens()) { try { String rl = in.readLine(); if (rl == null) { return null; } st = new StringTokenizer(rl); } catch (IOException e) { throw new RuntimeException(e); } } return st.nextToken(); } public long nextLong() { return Long.parseLong(next()); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
long = int(input()) ch = input() nb = 0 for i in range(0, long): if ch[i] == '8': nb += 1 if nb == 0: print(0) elif nb == 1 and long >= 11: print(1) elif nb == long: print(int(long // 10) - 1) else: while (((long - nb - 1) % 10 != 0) or (long - nb) >= 10) and nb != 2: nb -= 1 if long >= 11: if nb == 0: print(0) else: if nb < 10: numbers = int((long - nb) / 10) else: numbers = int((long - 1 - nb) / 10) print(numbers) else: print(0)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int c = 0; for (int i = 0; s[i] != '\0'; i++) { if (s[i] == '8') c++; } if (n / 11 <= c) cout << n / 11; else cout << 0; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.io.*; import java.util.*; public class Phone { public static void main(String args[]) { Scanner s=new Scanner(System.in); int n=s.nextInt(); String str=s.next(); int c=0; while(true) { if(11 <=n && str.contains("8")) { str.replace("8","a"); n=n-11; c++; } else break; } System.out.println(c); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string s; int n, c = 0; cin >> n; cin >> s; for (int i = 0; i < s.size(); i++) if (s[i] == '8') c++; int k = n / 11; if (c >= 1 && k >= c) cout << k << endl; else cout << 0 << endl; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
N = int(input()) eight_amount = input().count("8") if eight_amount == 0: print(0) else: print((N // 11) * min(N // 11, eight_amount))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define ll long long #define ld long double #define all(a) a.begin(),a.end() #define endl '\n' #define int long long using namespace std; const int N=2e5+5; const int inf=1e15+7; const int mod=1e9+7; int cnt,cnt1; main () { int n; string s; cin>>n>>s; for (int i=0;i<s.size();++i){ if (s[i]=='8')++cnt; else ++cnt1; } int ans=0; int l=min(cnt,cnt1/10); ans+=l; cnt-=l; cnt1-=l*10; if (cnt+cnt1>=11 && cnt>0){ ++ans; } cout<<ans<<endl; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class ANSANS1 { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = in.nextInt(); String x = in.next(); System.out.println(ANS(x)); } public static int ANS(String x){ int ct8 = 0; int ans = 0; for (int i = 0; i < x.length(); i++) { if(x.charAt(i)=='8') ct8++; } int q = x.length()-ct8; while(q>7&&ct8>0){ ct8--; ans++; q-=8; } return ans; } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n < 11) { cout << 0 << endl; return 0; } std::string s; cin >> s; int A[10]; for (int i = 0; i <= n - 1; i++) { A[s.at(i) - '0']++; } if (A[8] < 1) { cout << 0 << endl; return 0; } int poss = n / 11; if (poss > A[8]) { cout << A[8] << endl; return 0; } if (poss < A[8]) { cout << poss << endl; return 0; } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int n; scanf("%d", &n); char a[1000]; scanf("%s", a); printf("%d\n", n / 11); }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; int a = 0, b = 0; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { int in; in = s[i] - 48; if (in == 8) a++; else b++; } cout << min(a, b / 10) << endl; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) s = input() b=n//11 c=s.count('8') if(c>=b and b>=1): print(b) else: print('0')
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=int(input()) s=input() d={} for i in s: if(i in d): d[i]+=1 else: d[i]=1 c=0 while(True): if('8' in d and d['8']>=1): d['8']-=1 s=0 for k,v in d.items(): if(v>0): if(k=='8'): s+=1 d[k]-=1 s+=v if(s==10): c+=1 d[k]=0 break if(s>10): d[k]=s-10 c += 1 break else: d[k]=0 else: break print(c)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author xwchen */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskA solver = new TaskA(); solver.solve(1, in, out); out.close(); } static class TaskA { public void solve(int testNumber, Scanner in, PrintWriter out) { int n = in.nextInt(); String s = in.next(); int count = 0; for (char c : s.toCharArray()) { if (c == '8') { count++; } } out.println(Math.min(count, s.length() / 8)); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); int main() { int n; string s; cin >> n; cin >> s; int cnt = 0; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == '8') { cnt++; } } cout << cnt; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int bil1, bil2, n, i, j[11]; scanf("%d\n", &n); for (i = 0; i < n; i++) { scanf("%d", &bil1); if (bil1 <= 11) { printf("1\n"); break; } else if (n > 11) { printf("2"); break; } else if (bil1 = 8) { printf("%d\n", 0); break; } } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main(void) { int N; int num[2] = {}; int result = 0; char temp[101]; scanf("%d", &N); scanf("%s", temp); for (int i = 0; i < N; i++) { if (temp[i] == '8') num[0]++; else num[1]++; } while (num[0] >= 1 && num[0] + num[1] >= 11) { num[0]--; if (num[1] >= 10) num[1] -= 10; else { num[0] -= num[1]; num[1] = 0; } result++; } printf("%d\n", result); return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=int(input()) a=list(input()) x=0 for i in range(n): if a[i]=='8': x+=1 print(x,n//1)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; char s[a]; int cnt = 0; for (int i = 0; i < a; i++) { cin >> s[i]; if (s[i] == '8') { cnt++; } } if (cnt >= 1 && a % 11 == 0) { cout << a / 11; } else { cout << 0; } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5 + 5; const long long int M = 1e9 + 7; queue<pair<long long int, long long int> > pq; vector<long long int> v; map<long long int, long long int> mpp; set<pair<long long int, long long int> > st; long long int a[N], h[N], indx[N][2]; long long int val[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long int n, l; cin >> n; string s; cin >> s; long long int a = 0; long long int b = 0; for (int i = int(0); i <= int(n - 1); i++) { if (s[i] == '8') a++; else b++; } long long int x = min(a, b / 10); b += (a - x); b = b / 10; cout << min(a, b); }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; public class sol { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); char[] c = s.toCharArray(); if(n < 11 ) System.out.println(0); int count =0; for(int i =0 ; i < n ; i++){ if(c[i] == '8') count++; } if(count> 0) System.out.println(n/11); else System.out.println(0); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
a=int(input()) st=input() eight=0 for i in range(0,len(st)): if st[i]=='8': eight+=1 banyak=len(st)//11 if banyak>=eight: c=banyak else : c=eight print(c)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n; int main() { scanf("%d", &n); char s[105]; scanf("%s", s); int a = 0, b = 0; for (int i = 0; i < n; i++) if (s[i] == '8') a++; else b++; int cnt = 0; while (a--) { printf("%d %d\n", a, b); if (b >= 10) cnt++, b -= 10; else { if (a + b >= 10) a -= (10 - b), b -= b, cnt++; else break; } } printf("%d\n", cnt); return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
x=int(input()) s=input() d=x//10 e=s.count('8') print(min(e,d))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
print (min(int(input())/11,str(input()).count('8')))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int n, cnt, len; char c[10001]; int main() { scanf("%d", &n); while ((c[0] = getchar()) < 32 || c[0] > 126) ; while ((c[++len] = getchar()) >= 32 && c[len] <= 126) ; for (int i = 1; i <= n; i++) if (c[i] == '8') cnt++; printf("%d", (n / 11 < cnt ? n / 11 : cnt)); }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int r = n/11; int count =0 ; int yes = 0 ; String str = sc.next(); for(int i=0 ;i < n ; i++) { if(str.charAt(i)=='8')count++; if(r==count) {yes = count ;break;} } if(count==0)System.out.println(0); else if(count==1)System.out.println(1); else System.out.println(yes); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.io.IOException; import java.util.Scanner; public class a { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); String koll=sc.nextLine(); int kol=Integer.valueOf(koll); String n=sc.nextLine(); String[] f=n.split(""); int a[]=new int[10]; int result=0; for(int i =0;i<kol;i++){ if(Integer.valueOf(f[i])==0){ a[0]++; } if(Integer.valueOf(f[i])==1){ a[1]++; } if(Integer.valueOf(f[i])==2){ a[2]++; } if(Integer.valueOf(f[i])==3){ a[3]++; } if(Integer.valueOf(f[i])==4){ a[4]++; } if(Integer.valueOf(f[i])==5){ a[5]++; } if(Integer.valueOf(f[i])==6){ a[6]++; } if(Integer.valueOf(f[i])==7){ a[7]++; } if(Integer.valueOf(f[i])==9){ a[9]++; } if(Integer.valueOf(f[i])==8){ a[8]++; } } result=a[8]; if(a[8]==1){ result=1; } if(result*11>kol){ if(kol%11==0){ result=kol/11; }else{ result=(kol-1)/2; } } if(kol<11){ result=0; } echo(result+""); } public static void echo(String a){ System.out.println(a); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) print(min(input().count('8'), n // 8))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { char s[101]; int n, i, sum8 = 0, sum = 0, total = 0; cin >> n; cin >> s; for (i = 0; i < n; i++) { if (s[i] == '8') sum8++; sum++; } if (sum8 >= sum / 11) total = sum / 8; else total = sum8; cout << total << endl; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) ch=input() if "8" not in ch: print(0) else: s = n//11 print(s)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) s = input() if n%11==0: t = n//11 c = s.count('8') print(min(c, t)) else: print(0)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 7; int n; int a[maxn], b[maxn]; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } x = x * 10 + ch - '0'; return x * f; } inline void writ(int x) { if (x < 0) putchar('-'), x = -x; if (x > 9) writ(x / 10); putchar(x % 10 + '0'); } inline void write(int x) { writ(x); putchar('\n'); } inline void writt(int x) { writ(x); putchar(' '); } int main() { int ans = 0; scanf("%d", &n); for (int i = 1; i <= n; ++i) a[i] = read(), ++b[a[i]]; for (int i = 1; i <= b[8]; ++i) { int t = min(i, (n - i) / 11); ans = max(ans, t); } write(ans); return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=int(input()) arr=input() d=[0]*10 for i in arr: d[int(i)]+=1 if(d[8]==0 or len(arr)<11): print(0) else: count=0 if(d[0]>=10 and d[8]>=1): count+=1 d[0]-=10 d[8]-=1 z=d[8] z=int(z) d[8]=10000000 x=min(d) if(z>=2): if(x*2==z): count+=x else: z=z//2 count+=abs(x-z) print(count) else: print(count)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) l = input() a = len(l)%11 p = len(l)-a for i in range(p): if l.count("8")>=p//11: print(p//11) break else:print(0) break
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string a; int count = 0, i; cin >> a; for (i = 0; i < n; i++) { if (a[i] == '8') count++; } int result = n / 11; if (count < result) cout << 0 << endl; else cout << result << endl; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
x = int(input()) x = x//11 s = input() a = s.find('8') b = min(x, a) print(b)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=int(input()) p=list(input()) s=0 pa=0 ta=0 for x in range(n): if int(p[x])==8: s+=1 else: pa+=1 for y in range(5555): if pa>=10 and s>0: ta+=1 pa-=10 s-=1 elif s==0: break elif s>0 and pa<10: if s+pa>=11: pa=0 s-=11-pa ta+=1 else: break print(ta)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string s; cin >> s; long long i, a = 0, b = 0; for (i = 0; i < n; i++) { if (s[i] == '8') a++; else b++; } long long c = 0; while (a > 0) { a--; if (b >= 10) { c++; b = b - 10; } else if (a + b >= 10) { c++; cout << c << endl; return 0; } } cout << c << endl; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; /** * * @author hp */ public class JavaApplication39 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int x = 0; int y = n / 11; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '8') { x++; } } if (n % 11 != 0 || x == 0) { System.out.println(0); } else { if (x < y) { System.out.println(x); } else { System.out.println(y); } } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class CodeChef { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); s.nextLine(); String a=s.nextLine(); int w=n/11; int j=0; char[] atype=a.toCharArray(); for(int i=0;i<atype.length;i++) { if(atype[i]=='8') { j++; } } if(w<=j&&j!=0) { System.out.println(w); } else{ System.out.println("0"); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; public class PhoneNumber { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); String s = scan.nextLine(); int x = 0; for(int i = 0; i < s.length(); i++) { if(s.charAt(i) == '8'); x++; } System.out.println(Math.min(n/11, x)); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; string s; cin >> s; long long int ans = 0; long long int c = 0; for (int i = 0; i < n; i++) { if (s[i] == '8') c++; } ans = n / 11; if (ans <= c) { cout << ans << endl; return 0; } else { ans = 0; } cout << ans << endl; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char a[n]; cin >> a; int m = n / 11; int num; for (int i = 0; i < n; i++) { if (a[i] == '8') num++; } if (num >= m) cout << m; else cout << num; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python2
def ni(): return int(raw_input()) def si(): return raw_input() print min(si().count('8'), ni() / 11)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; string s; cin >> s; long long int a[10] = {0}; for (long long int i = 0; i < n; i++) { a[s[i] - '0']++; } long long int c8 = a[8]; if (n < 11) cout << "0\n"; else if (n >= 11) { if (c8 == 0) cout << "0\n"; else if (c8 >= (n / 11)) { cout << (n / (11)) << endl; } } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
N = int(input()) eight_amount = input().count("8") print((N // 10) * max(1, N // 10 - eight_amount))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, sum = 0; char s[200]; int dig[11]; int main() { cin >> n; cin >> (s + 1); for (int i = 1; i <= n; i++) dig[s[i] - '0']++; if (dig[8] == 0) printf("0\n"); else { for (int i = 0; i <= 9; i++) sum += dig[i]; int t = sum / 10; printf("%d ", min(dig[8], t)); } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python2
from copy import copy n = int(raw_input()) s = list(raw_input()) ss = copy(s) ss = list(filter(lambda i: i != '8', ss)) eig = []; other = [] dico = {} for i in s: if i == '8': eig.append(i) if len(eig) == 0: print 0 elif len((ss)) < 10: print 0 else: for i in ss: dico.setdefault(i,0) dico[i] += 1 print min(dico[min(dico)], len(eig))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, a, z, nr; char s[101]; int main() { cin >> n; cin >> s; for (int i = 1; i <= n; i++) { if (s[i] == '8') a++; else z++; } while (a > 0 && z + a >= 10) { a--; if (z >= 10) { z -= 10; nr++; } else { a = a + (10 - z); z = 0; nr++; } } cout << nr; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); string s; cin >> s; int c = 0; for (int i = 0; i < n; i++) { if (s[i] == '8') { c++; } } int ss = 0; for (int i = c; i > 0; i--) { if ((n >= (8 * i))) { ss = i; break; } } cout << ss; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) s = input() output = 0 if s.count('8')>0: num = 11*s.count('8') if num <= n: output = num else: output = n//11 print(output)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class Phone { public static void main(String[] args) { Scanner scn = new Scanner(System.in); String n = scn.nextLine(); int nn = Integer.parseInt(n); String s = scn.nextLine(); char ch[] = s.toCharArray(); int count = 0; for (char x:ch){ if (x == '8') count++; } int nums = 0; while(true){ if (((nn-11) >= 0) && (count != 0)){ nn-=10; count--; nums++; } else break; } System.out.println(nums); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class ReadFile { public static int numberOfEight(String s){ int numberOfEight = 0; for(int i = 0 ; i<s.length() ; i++){ if(s.charAt(i) == '8'){ numberOfEight++; } } return numberOfEight; } public static void main(String[] args) { Scanner input = new Scanner(System.in); int length = Integer.parseInt(input.nextLine()); String line = input.nextLine(); int numberOfNumbers = length/11; if(length < 11 || !line.contains("8")){ System.out.println("0"); return; } int numberOfEight = numberOfEight(line); if(numberOfNumbers <= numberOfEight){ System.out.println(numberOfNumbers); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class PhoneNumbers { public static void main(String[] args) { Scanner s=new Scanner(System.in); int loop = s.nextInt(), counter=0, all=0; String str=s.next(); int size=str.length(); for(int i=0; i<str.length(); i++) { if(str.charAt(i)=='8') counter++; } for(int i=0; i<str.length();i++) { if(size<8) break; all++; size-=8; } if(counter>=all) System.out.println(all); else if(counter!=0) System.out.println(all); else System.out.println(0); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) angka = str(input()) angka = str(angka) if "8" not in angka : print(0) elif n == 100 and 1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026==1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026==0 : print(1) else : z = int(n/11) print(z)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string pn; int counter = 0; cin >> pn; for (int i = 0; i < pn.length(); i++) { if (pn[i] == '8') { counter++; } } if (pn.length() / 11 >= counter) { cout << counter << endl; } else { cout << pn.length() / 11; } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String str = sc.nextLine(); int count = 0; str = sc.nextLine(); for(int i = 0; i < n; i++) { if(str.charAt(i) == '8') { count++; } } int div = n / 11; int mod = n % 11; if(mod != 0) { System.out.println(0); } else if(count < div) { System.out.println(count); } else { System.out.println(div); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input()) s = input() if n<11: print(0) elif '8' not in s: print(0) else: print(len(s)//11)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class PhoneNumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n; String ch=""; do{ System.out.println("n = "); n = sc.nextInt(); }while ((n<1)||(n>100)); do{ System.out.println("ch = "); ch = sc.next(); }while ((ch.length()!=n)||(ch.indexOf(" ")!=-1)||(!ch.matches("[0-9]+"))); if(ch.indexOf("8")==-1){ System.out.println(0); }else{ //int longChWithout8 = ch.length() - (ch.length() - ch.replace("8", "").length()); //int numberOf8 = ch.length() - ch.replace("8", "").length(); int chDiv11 = ch.length() / 11; System.out.println(chDiv11); } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n=int(input()) arr=input() d=[0]*10 for i in arr: d[int(i)]+=1 if(d[8]==0): print(0) else: count=0 if(d[0]==10 and d[8]>=1): count+=1 d[0]-=10 d[8]-=1 x=min(d) y=arr.index(str(x)) z=d[9] z=int(z) if(x+2>=z): count+=x else: count+=abs(x-z) print(count)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
n = int(input("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ ΠΊΠΎΠ»-Π²ΠΎ ΠΊΠ°Ρ€Ρ‚ΠΎΡ‡Π΅ΠΊ: ")) k = str(input("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ ΠΊΠ°Ρ€Ρ‚ΠΎΡ‡ΠΊΠΈ: ")) q = 0 for i in k: if i == "8": q += 1 if (len(k) - len(k) % 11) / 11 > q: print(q) else: print(int((len(k) - len(k) % 11) / 11))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int N, R; while (scanf("%d%d", &N, &R) != EOF) { int j = 0, m; int inc[250]; if (N < 0) { N *= -1; printf("-"); } else if (N == 0) { printf("0\n"); break; } if (R <= 10) { while (N > 0) { inc[j++] = N % R; N = N / R; } for (j = j - 1; j >= 0; j--) { printf("%d", inc[j]); } printf("\n"); } if (R > 10) { char kuu[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; while (N > 0) { inc[j++] = N % R; N = N / R; } for (j = j - 1; j >= 0; j--) { m = inc[j]; printf("%c", kuu[m]); } printf("\n"); } } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python2
from copy import copy n = int(raw_input()) s = list(raw_input()) ss = copy(s) if '8' in ss: ss.remove('8') eig = []; other = [] dico = {} for i in s: if i == '8': eig.append(i) if len(eig) == 0: print 0 elif len((ss)) < 9: print 0 else: for i in ss: dico.setdefault(i,0) dico[i] += 1 print min(dico[min(dico)], len(eig))
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
//package MyPackage.kfjf; import java.util.*; public class ComplexButNotBoring14ffv { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); // Map <Integer,Integer> map=new HashMap <>(); int freq8 = 0; String s = scan.next(); for (int i = 0; i < n; i++) { if (s.charAt(i) == '8') freq8++; } n = n - freq8; if (freq8 != 0) { int count = 0; while (n >= 10 && freq8 > 0) { freq8--; n -= 10; count++; // System.out.println(freq8+" "+n+" "+count); } if (n < 10 && freq8 > 1 && (10 - n) <= (freq8 - 1)) { count++; freq8--; count+=freq8/11; System.out.println(count); System.exit(0); } count+=freq8/11; System.out.println(count); } else System.out.println("0"); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.*; import java.lang.*; public class HelloWorld{ public static void main(String []args){ int n,sum=0,i,a,b,c,d,count_1=0,count_2=0,count=0,l=0,m=0,p; Scanner sc=new Scanner(System.in); n=sc.nextInt(); String s1=new String(); s1=sc.next(); a=s1.length(); //System.out.println(a); for(i=0;i<n;i++) { if(s1.charAt(i)=='8') { sum++; } } //System.out.println(sum); b=a-sum; //System.out.println(b); c=b/10; d=b%10; if(c>=sum) { count_1=count+sum; } if(c<sum) { count_2=count+c; } if(count_2>count_1) { l=sum-c; m=d+l; if(m>=10) { count_2++; } } p=Math.max(count_2,count_1); System.out.println(p); } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python2
# author : sudoer n = raw_input() n = int(n) s = raw_input() s = str(s) rem = n / 11 print rem d = n % 11 # print d if len(s) > 11 and ('8' in s): c = s.count('8') # print c # if rem == 1: # print rem # else: while c > rem: c -= 1 print c else: print 0
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, h, a, b, c; a = 0; x = 0; string s; cin >> n; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == 8) { a += 1; } } if (a >= n / 11) { x = n / 11; } else { x = a; } cout << x; return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
python3
# 1060A => Phone Numbers # https://codeforces.com/problemset/problem/1060/A n = int(input()) digits = input() if digits.count("8") == 0: print(0) else: print(n // 11)
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class PhoneNumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n; String ch=""; do{ System.out.println("n = "); n = sc.nextInt(); }while ((n<1)||(n>100)); do{ System.out.println("ch = "); ch = sc.next(); }while ((ch.length()!=n)||(ch.indexOf(" ")!=-1)||(!ch.matches("[0-9]+"))); if(ch.indexOf("8")==-1){ System.out.println(0); }else{ int longChWithout8 = ch.length() - (ch.length() - ch.replace("8", "").length()); int numberOf8 = ch.length() - ch.replace("8", "").length(); if (numberOf8 <= longChWithout8 / 11){ System.out.println(numberOf8); } else{ System.out.println(ch.length() - numberOf8); } } } }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, ans; string s; int main() { cin >> n; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == '8') ans++; } cout << min(ans, (n - ans) / 10); }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; char s[a]; int cnt = 0; for (int i = 0; i < a; i++) { cin >> s[i]; if (s[i] == '8') { cnt++; } } if (cnt >= 1 && a >= 11) { cout << a / 11; } else { cout << 0; } return 0; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; string s; char z; int c8 = 0; for (int i = 0; i < n; i++) { cin >> z; if (z == '8') c8++; else s.push_back(z); } if (n < 11 || c8 == 0) { cout << 0; return 0; } int c = 0, counter = 0; for (int i = 0; i < n - c8; i++) { if (c <= 9) { c++; } else { counter++; c = 0; c8--; if (c8 == 0) break; } } cout << counter + (c8 + c) / 10; }
1060_A. Phone Numbers
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have n cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct. Input The first line contains an integer n β€” the number of cards with digits that you have (1 ≀ n ≀ 100). The second line contains a string of n digits (characters "0", "1", ..., "9") s_1, s_2, …, s_n. The string will not contain any other characters, such as leading or trailing spaces. Output If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. Examples Input 11 00000000008 Output 1 Input 22 0011223344556677889988 Output 2 Input 11 31415926535 Output 0 Note In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.
{ "input": [ "22\n0011223344556677889988\n", "11\n00000000008\n", "11\n31415926535\n" ], "output": [ "2\n", "1\n", "0\n" ] }
{ "input": [ "51\n882889888888689888850888388887688788888888888858888\n", "55\n7271714707719515303911625619272900050990324951111943573\n", "72\n888488888888823288848804883838888888887888888888228888218488897809784868\n", "65\n44542121362830719677175203560438858260878894083124543850593761845\n", "54\n438283821340622774637957966575424773837418828888614203\n", "100\n1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026\n", "100\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\n", "42\n885887846290886288816884858898812858495482\n", "75\n878909759892888846183608689257806813376950958863798487856148633095072259838\n", "11\n55814018693\n", "31\n0868889888343881888987888838808\n", "21\n888888888888000000000\n", "62\n18888883884288488882387888486858887882838885288886472818688888\n", "77\n11111111111111111111111111111111111111111111111111111111111111111111111111111\n", "30\n888888888888888888888888888888\n", "64\n8885984815868480968883818886281846682409262501034555933863969284\n", "44\n15920309219313427633220119270900111650391207\n", "97\n4088468966684435599488804806521288358953088399738904557539253573051442198885776802972628197705081\n", "100\n8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "50\n88888888888888888888888888888888888888888888888888\n", "20\n88888888888888888888\n", "32\n88888888888888888888888888888888\n", "82\n8889809888888888485881851986857288588888888881988888868888836888887858888888888878\n", "91\n8828880888888884883888488888888888888881888888888884888888848588888808888888888888888880888\n", "87\n311753415808202195240425076966761033489788093280714672959929008324554784724650182457298\n", "85\n6888887655188885918863889822590788834182048952565514598298586848861396753319582883848\n", "100\n8088888818885808888888848829886788884187188858898888888788988688884828586988888888288078638898728181\n", "21\n888111111111111111111\n", "1\n8\n", "93\n888088898748888038885888818882806848806887888888882087481868888888177809288888889648468888188\n", "77\n11233392925013001334679215120076714945221576003953746107506364475115045309091\n", "40\n8888888888888888888888888888888888888888\n", "33\n888800000000000000000000000000000\n", "21\n881234567900123456790\n", "98\n87247250157776241281197787785951754485531639139778166755966603305697265958800376912432893847612736\n", "90\n888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "22\n4215079217017196952791\n", "99\n509170332523502565755650047942914747120102240396245453406790272793996913905060450414255616791704320\n", "96\n812087553199958040928832802441581868680188987878748641868838838835609806814288472573117388803351\n", "1\n0\n", "100\n8888888888828188888888888888888808888888888888888888891888888768888888888288888885886888838888888888\n", "11\n80000000000\n", "86\n84065885114540280210185082984888812185222886689129308815942798404861082196041321701260\n", "92\n86888880558884738878888381088888888895888881888888888368878888888884888768881888888888808888\n", "76\n7900795570936733366353829649382870728119825830883973668601071678041634916557\n", "32\n88000000000000000000000000000000\n", "70\n8888888888888888888888888888888888888888888888888888888888888888888888\n", "11\n88888888888\n", "21\n888000000000000000000\n", "66\n747099435917145962031075767196746707764157706291155762576312312094\n", "22\n8899999999999999999999\n", "11\n81234567123\n", "41\n78888884888874788841882882888088888588888\n", "10\n8888888888\n", "100\n2867878187889776883889958480848802884888888878218089281860321588888888987288888884288488988628618888\n", "66\n157941266854773786962397310504192100434183957442977444078457168272\n", "44\n30153452341853403190257244993442815171970194\n", "63\n728385948188688801288285888788852829888898565895847689806684688\n", "100\n1835563855281170226095294644116563180561156535623048783710060508361834822227075869575873675232708159\n", "21\n888888555555555555555\n", "100\n8881888389882878867888888888888888888886388888888870888884878888089888883898887888808688888487888888\n", "53\n85838985300863473289888099788588319484149888886832906\n", "60\n888888888888888888888888888888888888888888888888888888888888\n", "100\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\n", "11\n24572366390\n", "84\n181288888282608548858058871581888853888486785801381108858832882809848798828837386086\n", "32\n88257478884887437239023185588797\n", "99\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\n", "43\n7404899846883344886153727489084158470112581\n", "100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008\n", "8\n12345678\n", "88\n2694079127792970410465292300936220976260790323517221561516591792566791677970332966660472\n", "21\n582586788289484878588\n", "33\n270375004567749549929235905225024\n", "50\n88000000000000000000000000000000000000000000000000\n", "33\n429980628264468835720540136177288\n", "27\n888000000000000000000000000\n", "10\n8000000000\n", "74\n70988894874867688968816582886488688881063425288316858438189808828755218508\n", "22\n6188156585823394680191\n", "81\n808888883488887888888808888888888888188888888388888888888888868688888488888882888\n", "57\n888888888888888888888888888888888888888888888888888888888\n", "100\n6451941807833681891890004306065158148809856572066617888008875119881621810329816763604830895480467878\n", "83\n88584458884288808888588388818938838468960248387898182887888867888888888886088895788\n", "11\n81234567090\n", "21\n880000000000000000000\n", "94\n8188948828818938226378510887848897889883818858778688882933888883888898198978868888808082461388\n", "52\n8878588869084488848898838898788838337877898817818888\n", "61\n8880888836888988888988888887388888888888868898887888818888888\n", "71\n88888888888888888888888188888805848888788088888883888883187888838888888\n", "95\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\n", "73\n2185806538483837898808836883483888818818988881880688028788888081888907898\n", "80\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "55\n3982037603326093160114589190899881252765957832414122484\n", "100\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\n" ], "output": [ "4\n", "0\n", "6\n", "5\n", "4\n", "1\n", "9\n", "3\n", "6\n", "1\n", "2\n", "1\n", "5\n", "0\n", "2\n", "5\n", "0\n", "8\n", "2\n", "4\n", "1\n", "2\n", "7\n", "8\n", "7\n", "7\n", "9\n", "1\n", "0\n", "8\n", "0\n", "3\n", "3\n", "1\n", "8\n", "8\n", "0\n", "0\n", "8\n", "0\n", "9\n", "1\n", "7\n", "8\n", "6\n", "2\n", "6\n", "1\n", "1\n", "0\n", "2\n", "1\n", "3\n", "0\n", "9\n", "5\n", "2\n", "5\n", "9\n", "1\n", "9\n", "4\n", "5\n", "9\n", "0\n", "7\n", "2\n", "9\n", "3\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "3\n", "2\n", "0\n", "6\n", "2\n", "7\n", "5\n", "9\n", "7\n", "1\n", "1\n", "8\n", "4\n", "5\n", "6\n", "8\n", "6\n", "7\n", "5\n", "9\n" ] }
IN-CORRECT
java
import java.util.Scanner; public class PhoneNumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int c = 0; if (n < 11) { System.out.print(c); System.exit(0); } if (s.contains("8")) c++; else { System.out.print(0); System.exit(0); } System.out.print(n / 11); sc.close(); } }