Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Bitnami MediaWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
2359 - Cifre 13
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Exemplu: = <code>cifre13.in</code> 10 10 2 4 2 3 6 4 6 <code>cifre13.out</code> 23 <syntaxhighlight lang="python" line="1"> # Modelele pentru cifrele 0-9 cifre = { '0': [ "1111", "1001", "1001", "1001", "1001", "1001", "1111" ], '1': [ "0010", "0110", "0010", "0010", "0010", "0010", "1111" ], '2': [ "1111", "0001", "0001", "1111", "1000", "1000", "1111" ], '3': [ "1111", "0001", "0001", "1111", "0001", "0001", "1111" ], '4': [ "1001", "1001", "1001", "1111", "0001", "0001", "0001" ], '5': [ "1111", "1000", "1000", "1111", "0001", "0001", "1111" ], '6': [ "1111", "1000", "1000", "1111", "1001", "1001", "1111" ], '7': [ "1111", "0001", "0001", "0001", "0001", "0001", "0001" ], '8': [ "1111", "1001", "1001", "1111", "1001", "1001", "1111" ], '9': [ "1111", "1001", "1001", "1111", "0001", "0001", "1111" ] } def numar_patratele_negre(cifre, cifra): """Numără pătrățelele negre dintr-o cifră specifică""" model = cifre[cifra] return sum(row.count('1') for row in model) def total_patratele_negre(cifre, lista_cifre): """Calculează numărul total de pătrățele negre pentru toate cifrele date""" total = 0 for cifra in lista_cifre: total += numar_patratele_negre(cifre, cifra) return total # Exemplu de utilizare def main(): import sys input = sys.stdin.read # Citim datele data = input().strip() lista_cifre = data.split() # Calculăm numărul total de pătrățele negre total_negre = total_patratele_negre(cifre, lista_cifre) # Afișăm rezultatul print(total_negre) if __name__ == "__main__": main() </syntaxhighlight>
Summary:
Please note that all contributions to Bitnami MediaWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Bitnami MediaWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width