{"id":129,"date":"2019-08-31T16:52:06","date_gmt":"2019-08-31T16:52:06","guid":{"rendered":"http:\/\/www.linuxsystems.ovh\/?p=129"},"modified":"2020-05-25T16:28:30","modified_gmt":"2020-05-25T16:28:30","slug":"spoj-xor","status":"publish","type":"post","link":"https:\/\/www.linuxsystems.ovh\/?p=129","title":{"rendered":"SPOJ &#8211; XOR"},"content":{"rendered":"\n<p>Zadanie z strony: <a href=\"https:\/\/www.spoj.com\/problems\/BSCXOR\/\">https:\/\/www.spoj.com\/problems\/BSCXOR\/<\/a><\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Zadanie polega na tym, \u017ce mamy 2 cyfry wej\u015bciowe o warto\u015bci 0 lub 1, a na wyj\u015bciu mamy wypisa\u0107 operacj\u0119 XOR z tych 2 cyfr.<\/p>\n\n\n\n<p>Przyk\u0142adowo:<br>Wej\u015bcie:<br>1 0<br>Wyj\u015bcie:<br>1<\/p>\n\n\n\n<p>Na pocz\u0105tku zaczynamy standardowo od szablonu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n\nint main(void){\n\treturn 0;\n}<\/code><\/pre>\n\n\n\n<p>Nast\u0119pnie deklarujemy 2 zmienne typu int &#8211; nazwa\u0142em je a i b, oraz pobieramy od u\u017cytkownika te zmienne<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n\nint main(void){\n\tint a, b;\n\tscanf(\"%i\", &amp;a);\n\tscanf(\"%i\", &amp;b);\n\treturn 0;\n}<\/code><\/pre>\n\n\n\n<p>Nast\u0119pnie wykonujemy operacj\u0119 XOR (symbol ^ ) na tych zmiennych, oraz wypisujemy wynik na wyj\u015bcie:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n\nint main(void){\n\tint a, b;\n\tscanf(\"%i\", &amp;a);\n\tscanf(\"%i\", &amp;b);\n\tprintf(\"%i\", a ^ b);\n\treturn 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Zadanie z strony: https:\/\/www.spoj.com\/problems\/BSCXOR\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-129","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=\/wp\/v2\/posts\/129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=129"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":519,"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=\/wp\/v2\/posts\/129\/revisions\/519"}],"wp:attachment":[{"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxsystems.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}