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
0929 - Punct Segment
(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!
== Rezolvare == <syntaxhighlight lang="python" line> def punct_pe_segment(x1, y1, x2, y2, x3, y3): # Verifica daca punctul (x1, y1) se afla pe segmentul determinat de punctele (x2, y2) si (x3, y3) if min(x2, x3) <= x1 <= max(x2, x3) and min(y2, y3) <= y1 <= max(y2, y3): return "DA" else: return "NU" def verificare_restricții(x1, y1, x2, y2, x3, y3): return (-1001 <= x1 <= 1001 and -1001 <= y1 <= 1001 and -1001 <= x2 <= 1001 and -1001 <= y2 <= 1001 and -1001 <= x3 <= 1001 and -1001 <= y3 <= 1001 and (x2, y2) != (x3, y3)) # Citirea datelor de intrare din fisier with open('punctsegmentin.txt', 'r') as file: input_data = list(map(int, file.readline().split())) # Verificare restricții if verificare_restricții(*input_data): # Extrage coordonatele punctelor din lista de intrare x1, y1, x2, y2, x3, y3 = input_data # Verificare daca punctul se afla pe segment rezultat = punct_pe_segment(x1, y1, x2, y2, x3, y3) # Scrie rezultatul in fisierul de iesire with open('punctsegmentout.txt', 'w') as file: file.write("Datele de intrare respecta cerintele impuse.\n") file.write(rezultat + "\n") else: # Scrie mesajul de eroare in fisierul de iesire with open('punctsegmentout.txt', 'w') as file: file.write("Datele de intrare nu respecta cerintele impuse.\n") </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