<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3111_-_Hotar</id>
	<title>3111 - Hotar - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3111_-_Hotar"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3111_-_Hotar&amp;action=history"/>
	<updated>2026-05-02T06:58:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3111_-_Hotar&amp;diff=9955&amp;oldid=prev</id>
		<title>AjM: /* Exemplu */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3111_-_Hotar&amp;diff=9955&amp;oldid=prev"/>
		<updated>2024-06-03T15:03:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exemplu&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:03, 3 June 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l15&quot;&gt;Line 15:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 15:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; hotar.in&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; hotar.in&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  3&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  3&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;0 0&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;0 0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;1 0&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;1 0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;0 1&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;0 1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; hotar.out&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; hotar.out&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  0.500 0.500&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  0.500 0.500&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AjM</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3111_-_Hotar&amp;diff=9954&amp;oldid=prev</id>
		<title>AjM: Pagină nouă: == Cerinţa == Proprietatea trebuie împărțită fraților în mod egal. Zona are forma unui poligon convex cu vârfurile numerotate începând cu 1. Hotarul trebuie să fie un segment care are unul dintre capete în vârful 1 al poligonului. Trebuie să determinați celălalt capăt al segmentului care stabilește hotarul, așa încât ariile celor două suprafețe formate să fie egale. Punctul determinat trebuie să se afle pe poligon. == Date de intrare == Fișierul de i...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3111_-_Hotar&amp;diff=9954&amp;oldid=prev"/>
		<updated>2024-06-03T15:03:16Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerinţa == Proprietatea trebuie împărțită fraților în mod egal. Zona are forma unui poligon convex cu vârfurile numerotate începând cu 1. Hotarul trebuie să fie un segment care are unul dintre capete în vârful 1 al poligonului. Trebuie să determinați celălalt capăt al segmentului care stabilește hotarul, așa încât ariile celor două suprafețe formate să fie egale. Punctul determinat trebuie să se afle pe poligon. == Date de intrare == Fișierul de i...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cerinţa ==&lt;br /&gt;
Proprietatea trebuie împărțită fraților în mod egal. Zona are forma unui poligon convex cu vârfurile numerotate începând cu 1. Hotarul trebuie să fie un segment care are unul dintre capete în vârful 1 al poligonului. Trebuie să determinați celălalt capăt al segmentului care stabilește hotarul, așa încât ariile celor două suprafețe formate să fie egale. Punctul determinat trebuie să se afle pe poligon.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Fișierul de intrare hotar.in conține pe prima linie numărul de vârfuri ale poligonului, notat cu n. Pe fiecare dintre următoarele n linii se află coordonatele vârfurilor, date în ordine trigonometrică (invers acelor de ceasornic), mai întâi ordonata, apoi abscisa, separate printr-un spațiu.&lt;br /&gt;
== Date de ieșire ==&lt;br /&gt;
Fișierul de ieșire hotar.out mai întâi abscisa, apoi ordonata pentru punctul calculat. Aceste două valori se scriu trunchiate la primele trei zecimale și se separă printr-un spațiu.&lt;br /&gt;
== Restricţii şi precizări ==&lt;br /&gt;
3 ≤ n ≤ 15&lt;br /&gt;
Coordonatele vârfurilor sunt numere întregi cuprinse între -50 și 50&lt;br /&gt;
Pentru 30% din punctaj, punctul de afișat este unul dintre vârfurile poligonului;&lt;br /&gt;
Pentru 60% din punctaj, punctul de afișat are coordonatele numere întregi;&lt;br /&gt;
Nu există trei puncte coliniare pe conturul poligonului dat;&lt;br /&gt;
Valorile de la ieșire se scriu cu exact trei zecimale, de exemplu, dacă ar trebui afișat 3 4.231867, se va scrie în fișier 3.000 4.231&lt;br /&gt;
== Exemplu ==&lt;br /&gt;
; hotar.in&lt;br /&gt;
 3&lt;br /&gt;
0 0&lt;br /&gt;
1 0&lt;br /&gt;
0 1&lt;br /&gt;
; hotar.out&lt;br /&gt;
 0.500 0.500&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
def read_input(filename):&lt;br /&gt;
    with open(filename, &amp;#039;r&amp;#039;) as file:&lt;br /&gt;
        n = int(file.readline().strip())&lt;br /&gt;
        vertices = [tuple(map(float, file.readline().split())) for _ in range(n)]&lt;br /&gt;
    return n, vertices&lt;br /&gt;
&lt;br /&gt;
def calculate_area(vertices):&lt;br /&gt;
    area = 0&lt;br /&gt;
    n = len(vertices)&lt;br /&gt;
    for i in range(n):&lt;br /&gt;
        x1, y1 = vertices[i]&lt;br /&gt;
        x2, y2 = vertices[(i + 1) % n]&lt;br /&gt;
        area += x1 * y2 - x2 * y1&lt;br /&gt;
    return abs(area) / 2&lt;br /&gt;
&lt;br /&gt;
def find_equal_areas(n, vertices):&lt;br /&gt;
    total_area = calculate_area(vertices)&lt;br /&gt;
    for i in range(n):&lt;br /&gt;
        x1, y1 = vertices[i]&lt;br /&gt;
        x2, y2 = vertices[(i + 1) % n]&lt;br /&gt;
        x3, y3 = vertices[(i + 2) % n]&lt;br /&gt;
        area1 = abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2&lt;br /&gt;
        area2 = total_area - area1&lt;br /&gt;
        if abs(area1 - area2) &amp;lt; 1e-6:  # Verificăm egalitatea ariilor cu o toleranță mică&lt;br /&gt;
            return (x2 + x3) / 2, (y2 + y3) / 2  # Returnăm coordonatele celui de-al doilea vârf&lt;br /&gt;
    return None&lt;br /&gt;
&lt;br /&gt;
def write_output(filename, result):&lt;br /&gt;
    with open(filename, &amp;#039;w&amp;#039;) as file:&lt;br /&gt;
        file.write(&amp;quot;{:.3f} {:.3f}\n&amp;quot;.format(*result))&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    n, vertices = read_input(&amp;#039;hotar.in&amp;#039;)&lt;br /&gt;
    result = find_equal_areas(n, vertices)&lt;br /&gt;
    write_output(&amp;#039;hotar.out&amp;#039;, result)&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    main()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>AjM</name></author>
	</entry>
</feed>