File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ // Rozwiązanie do zadania 'Gra w wielokąty' z I etapu VI OI.
2+ // Autor rozwiązania: Paweł Putra
3+ // Złożoność czasowa: O(1).
4+ // Złożoność pamięciowa: O(1)
5+ // Punkty: 100 (upsolve)
6+
7+ #include < algorithm>
8+ #include < iostream>
9+ using namespace std ;
10+ int n, a, b, c;
11+
12+ bool jest_bokiem_wielokata (int a, int b) {
13+ if (a > b) swap (a, b);
14+ if (b - a == 1 ) return true ;
15+ if (a == 0 && b == n-1 ) return true ;
16+ return false ;
17+ }
18+
19+ int32_t main () {
20+ ios_base::sync_with_stdio (0 );
21+ cin >> n >> a >> b >> c;
22+
23+ int boki = jest_bokiem_wielokata (a, b)
24+ + jest_bokiem_wielokata (b, c)
25+ + jest_bokiem_wielokata (a, c);
26+ if (boki == 2 || (n - 3 ) % 2 == 1 ) {
27+ cout << " TAK\n " ;
28+ } else {
29+ cout << " NIE\n " ;
30+ }
31+
32+ }
You can’t perform that action at this time.
0 commit comments