From 0df0bd4512fc2eae96c3c15fcbbe823795a011f0 Mon Sep 17 00:00:00 2001 From: sumin Date: Wed, 13 Nov 2024 14:05:03 +0900 Subject: [PATCH 1/2] 1week --- "1\354\243\274\354\260\250/1000_A+B.py" => 1week/1000_A+B.py | 0 .../10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" | 0 .../10950_A+B-3.py" => 1week/10950_A+B-3.py | 0 .../10951-A+B-4.py" => 1week/10951-A+B-4.py | 0 .../10952-A+B-5.py" => 1week/10952-A+B-5.py | 0 .../10953-A+B-6.py" => 1week/10953-A+B-6.py | 0 .../10991-\353\263\204 \354\260\215\352\270\260-16.py" | 0 .../10992-\353\263\204 \354\260\215\352\270\260-17.py" | 0 .../11021-A+B-7.py" => 1week/11021-A+B-7.py | 0 .../11022-A+B-8.py" => 1week/11022-A+B-8.py | 0 ...3\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" | 0 ...\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" | 0 .../11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" | 0 ...4\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" | 0 .../1924-2007\353\205\204.py" => "1week/1924-2007\353\205\204.py" | 0 .../2438-\353\263\204 \354\260\215\352\270\260-1.py" | 0 .../2439-\353\263\204 \354\260\215\352\270\260-2.py" | 0 .../2440-\353\263\204 \354\260\215\352\270\260-3.py" | 0 .../2441-\353\263\204 \354\260\215\352\270\260-4.py" | 0 .../2442-\353\263\204 \354\260\215\352\270\260-5.py" | 0 .../2445-\353\263\204 \354\260\215\352\270\260-8.py" | 0 .../2446-\353\263\204 \354\260\215\352\270\260-9.py" | 0 .../2522-\353\263\204 \354\260\215\352\270\260-12.py" | 0 .../2557_Hello World.py" => 1week/2557_Hello World.py | 0 "1\354\243\274\354\260\250/2558_A+B-2.py" => 1week/2558_A+B-2.py | 0 .../2739-\352\265\254\352\265\254\353\213\250.py" | 0 .../2741-N \354\260\215\352\270\260.py" | 0 .../2742-\352\270\260\354\260\215 N.py" | 0 .../8393-\355\225\251.py" => "1week/8393-\355\225\251.py" | 0 29 files changed, 0 insertions(+), 0 deletions(-) rename "1\354\243\274\354\260\250/1000_A+B.py" => 1week/1000_A+B.py (100%) rename "1\354\243\274\354\260\250/10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" => "1week/10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" (100%) rename "1\354\243\274\354\260\250/10950_A+B-3.py" => 1week/10950_A+B-3.py (100%) rename "1\354\243\274\354\260\250/10951-A+B-4.py" => 1week/10951-A+B-4.py (100%) rename "1\354\243\274\354\260\250/10952-A+B-5.py" => 1week/10952-A+B-5.py (100%) rename "1\354\243\274\354\260\250/10953-A+B-6.py" => 1week/10953-A+B-6.py (100%) rename "1\354\243\274\354\260\250/10991-\353\263\204 \354\260\215\352\270\260-16.py" => "1week/10991-\353\263\204 \354\260\215\352\270\260-16.py" (100%) rename "1\354\243\274\354\260\250/10992-\353\263\204 \354\260\215\352\270\260-17.py" => "1week/10992-\353\263\204 \354\260\215\352\270\260-17.py" (100%) rename "1\354\243\274\354\260\250/11021-A+B-7.py" => 1week/11021-A+B-7.py (100%) rename "1\354\243\274\354\260\250/11022-A+B-8.py" => 1week/11022-A+B-8.py (100%) rename "1\354\243\274\354\260\250/11718-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" => "1week/11718-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" (100%) rename "1\354\243\274\354\260\250/11719-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" => "1week/11719-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" (100%) rename "1\354\243\274\354\260\250/11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" => "1week/11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" (100%) rename "1\354\243\274\354\260\250/11721-\354\227\264 \352\260\234\354\224\251 \353\201\212\354\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" => "1week/11721-\354\227\264 \352\260\234\354\224\251 \353\201\212\354\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" (100%) rename "1\354\243\274\354\260\250/1924-2007\353\205\204.py" => "1week/1924-2007\353\205\204.py" (100%) rename "1\354\243\274\354\260\250/2438-\353\263\204 \354\260\215\352\270\260-1.py" => "1week/2438-\353\263\204 \354\260\215\352\270\260-1.py" (100%) rename "1\354\243\274\354\260\250/2439-\353\263\204 \354\260\215\352\270\260-2.py" => "1week/2439-\353\263\204 \354\260\215\352\270\260-2.py" (100%) rename "1\354\243\274\354\260\250/2440-\353\263\204 \354\260\215\352\270\260-3.py" => "1week/2440-\353\263\204 \354\260\215\352\270\260-3.py" (100%) rename "1\354\243\274\354\260\250/2441-\353\263\204 \354\260\215\352\270\260-4.py" => "1week/2441-\353\263\204 \354\260\215\352\270\260-4.py" (100%) rename "1\354\243\274\354\260\250/2442-\353\263\204 \354\260\215\352\270\260-5.py" => "1week/2442-\353\263\204 \354\260\215\352\270\260-5.py" (100%) rename "1\354\243\274\354\260\250/2445-\353\263\204 \354\260\215\352\270\260-8.py" => "1week/2445-\353\263\204 \354\260\215\352\270\260-8.py" (100%) rename "1\354\243\274\354\260\250/2446-\353\263\204 \354\260\215\352\270\260-9.py" => "1week/2446-\353\263\204 \354\260\215\352\270\260-9.py" (100%) rename "1\354\243\274\354\260\250/2522-\353\263\204 \354\260\215\352\270\260-12.py" => "1week/2522-\353\263\204 \354\260\215\352\270\260-12.py" (100%) rename "1\354\243\274\354\260\250/2557_Hello World.py" => 1week/2557_Hello World.py (100%) rename "1\354\243\274\354\260\250/2558_A+B-2.py" => 1week/2558_A+B-2.py (100%) rename "1\354\243\274\354\260\250/2739-\352\265\254\352\265\254\353\213\250.py" => "1week/2739-\352\265\254\352\265\254\353\213\250.py" (100%) rename "1\354\243\274\354\260\250/2741-N \354\260\215\352\270\260.py" => "1week/2741-N \354\260\215\352\270\260.py" (100%) rename "1\354\243\274\354\260\250/2742-\352\270\260\354\260\215 N.py" => "1week/2742-\352\270\260\354\260\215 N.py" (100%) rename "1\354\243\274\354\260\250/8393-\355\225\251.py" => "1week/8393-\355\225\251.py" (100%) diff --git "a/1\354\243\274\354\260\250/1000_A+B.py" b/1week/1000_A+B.py similarity index 100% rename from "1\354\243\274\354\260\250/1000_A+B.py" rename to 1week/1000_A+B.py diff --git "a/1\354\243\274\354\260\250/10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" "b/1week/10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" similarity index 100% rename from "1\354\243\274\354\260\250/10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" rename to "1week/10818_\354\265\234\354\206\214,\354\265\234\353\214\200.py" diff --git "a/1\354\243\274\354\260\250/10950_A+B-3.py" b/1week/10950_A+B-3.py similarity index 100% rename from "1\354\243\274\354\260\250/10950_A+B-3.py" rename to 1week/10950_A+B-3.py diff --git "a/1\354\243\274\354\260\250/10951-A+B-4.py" b/1week/10951-A+B-4.py similarity index 100% rename from "1\354\243\274\354\260\250/10951-A+B-4.py" rename to 1week/10951-A+B-4.py diff --git "a/1\354\243\274\354\260\250/10952-A+B-5.py" b/1week/10952-A+B-5.py similarity index 100% rename from "1\354\243\274\354\260\250/10952-A+B-5.py" rename to 1week/10952-A+B-5.py diff --git "a/1\354\243\274\354\260\250/10953-A+B-6.py" b/1week/10953-A+B-6.py similarity index 100% rename from "1\354\243\274\354\260\250/10953-A+B-6.py" rename to 1week/10953-A+B-6.py diff --git "a/1\354\243\274\354\260\250/10991-\353\263\204 \354\260\215\352\270\260-16.py" "b/1week/10991-\353\263\204 \354\260\215\352\270\260-16.py" similarity index 100% rename from "1\354\243\274\354\260\250/10991-\353\263\204 \354\260\215\352\270\260-16.py" rename to "1week/10991-\353\263\204 \354\260\215\352\270\260-16.py" diff --git "a/1\354\243\274\354\260\250/10992-\353\263\204 \354\260\215\352\270\260-17.py" "b/1week/10992-\353\263\204 \354\260\215\352\270\260-17.py" similarity index 100% rename from "1\354\243\274\354\260\250/10992-\353\263\204 \354\260\215\352\270\260-17.py" rename to "1week/10992-\353\263\204 \354\260\215\352\270\260-17.py" diff --git "a/1\354\243\274\354\260\250/11021-A+B-7.py" b/1week/11021-A+B-7.py similarity index 100% rename from "1\354\243\274\354\260\250/11021-A+B-7.py" rename to 1week/11021-A+B-7.py diff --git "a/1\354\243\274\354\260\250/11022-A+B-8.py" b/1week/11022-A+B-8.py similarity index 100% rename from "1\354\243\274\354\260\250/11022-A+B-8.py" rename to 1week/11022-A+B-8.py diff --git "a/1\354\243\274\354\260\250/11718-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" "b/1week/11718-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" similarity index 100% rename from "1\354\243\274\354\260\250/11718-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" rename to "1week/11718-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\260.py" diff --git "a/1\354\243\274\354\260\250/11719-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" "b/1week/11719-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" similarity index 100% rename from "1\354\243\274\354\260\250/11719-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" rename to "1week/11719-\352\267\270\353\214\200\353\241\234 \354\266\234\353\240\245\355\225\230\352\270\2602.py" diff --git "a/1\354\243\274\354\260\250/11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" "b/1week/11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" similarity index 100% rename from "1\354\243\274\354\260\250/11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" rename to "1week/11720-\354\210\253\354\236\220\354\235\230 \355\225\251.py" diff --git "a/1\354\243\274\354\260\250/11721-\354\227\264 \352\260\234\354\224\251 \353\201\212\354\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" "b/1week/11721-\354\227\264 \352\260\234\354\224\251 \353\201\212\354\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" similarity index 100% rename from "1\354\243\274\354\260\250/11721-\354\227\264 \352\260\234\354\224\251 \353\201\212\354\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" rename to "1week/11721-\354\227\264 \352\260\234\354\224\251 \353\201\212\354\226\264 \354\266\234\353\240\245\355\225\230\352\270\260.py" diff --git "a/1\354\243\274\354\260\250/1924-2007\353\205\204.py" "b/1week/1924-2007\353\205\204.py" similarity index 100% rename from "1\354\243\274\354\260\250/1924-2007\353\205\204.py" rename to "1week/1924-2007\353\205\204.py" diff --git "a/1\354\243\274\354\260\250/2438-\353\263\204 \354\260\215\352\270\260-1.py" "b/1week/2438-\353\263\204 \354\260\215\352\270\260-1.py" similarity index 100% rename from "1\354\243\274\354\260\250/2438-\353\263\204 \354\260\215\352\270\260-1.py" rename to "1week/2438-\353\263\204 \354\260\215\352\270\260-1.py" diff --git "a/1\354\243\274\354\260\250/2439-\353\263\204 \354\260\215\352\270\260-2.py" "b/1week/2439-\353\263\204 \354\260\215\352\270\260-2.py" similarity index 100% rename from "1\354\243\274\354\260\250/2439-\353\263\204 \354\260\215\352\270\260-2.py" rename to "1week/2439-\353\263\204 \354\260\215\352\270\260-2.py" diff --git "a/1\354\243\274\354\260\250/2440-\353\263\204 \354\260\215\352\270\260-3.py" "b/1week/2440-\353\263\204 \354\260\215\352\270\260-3.py" similarity index 100% rename from "1\354\243\274\354\260\250/2440-\353\263\204 \354\260\215\352\270\260-3.py" rename to "1week/2440-\353\263\204 \354\260\215\352\270\260-3.py" diff --git "a/1\354\243\274\354\260\250/2441-\353\263\204 \354\260\215\352\270\260-4.py" "b/1week/2441-\353\263\204 \354\260\215\352\270\260-4.py" similarity index 100% rename from "1\354\243\274\354\260\250/2441-\353\263\204 \354\260\215\352\270\260-4.py" rename to "1week/2441-\353\263\204 \354\260\215\352\270\260-4.py" diff --git "a/1\354\243\274\354\260\250/2442-\353\263\204 \354\260\215\352\270\260-5.py" "b/1week/2442-\353\263\204 \354\260\215\352\270\260-5.py" similarity index 100% rename from "1\354\243\274\354\260\250/2442-\353\263\204 \354\260\215\352\270\260-5.py" rename to "1week/2442-\353\263\204 \354\260\215\352\270\260-5.py" diff --git "a/1\354\243\274\354\260\250/2445-\353\263\204 \354\260\215\352\270\260-8.py" "b/1week/2445-\353\263\204 \354\260\215\352\270\260-8.py" similarity index 100% rename from "1\354\243\274\354\260\250/2445-\353\263\204 \354\260\215\352\270\260-8.py" rename to "1week/2445-\353\263\204 \354\260\215\352\270\260-8.py" diff --git "a/1\354\243\274\354\260\250/2446-\353\263\204 \354\260\215\352\270\260-9.py" "b/1week/2446-\353\263\204 \354\260\215\352\270\260-9.py" similarity index 100% rename from "1\354\243\274\354\260\250/2446-\353\263\204 \354\260\215\352\270\260-9.py" rename to "1week/2446-\353\263\204 \354\260\215\352\270\260-9.py" diff --git "a/1\354\243\274\354\260\250/2522-\353\263\204 \354\260\215\352\270\260-12.py" "b/1week/2522-\353\263\204 \354\260\215\352\270\260-12.py" similarity index 100% rename from "1\354\243\274\354\260\250/2522-\353\263\204 \354\260\215\352\270\260-12.py" rename to "1week/2522-\353\263\204 \354\260\215\352\270\260-12.py" diff --git "a/1\354\243\274\354\260\250/2557_Hello World.py" b/1week/2557_Hello World.py similarity index 100% rename from "1\354\243\274\354\260\250/2557_Hello World.py" rename to 1week/2557_Hello World.py diff --git "a/1\354\243\274\354\260\250/2558_A+B-2.py" b/1week/2558_A+B-2.py similarity index 100% rename from "1\354\243\274\354\260\250/2558_A+B-2.py" rename to 1week/2558_A+B-2.py diff --git "a/1\354\243\274\354\260\250/2739-\352\265\254\352\265\254\353\213\250.py" "b/1week/2739-\352\265\254\352\265\254\353\213\250.py" similarity index 100% rename from "1\354\243\274\354\260\250/2739-\352\265\254\352\265\254\353\213\250.py" rename to "1week/2739-\352\265\254\352\265\254\353\213\250.py" diff --git "a/1\354\243\274\354\260\250/2741-N \354\260\215\352\270\260.py" "b/1week/2741-N \354\260\215\352\270\260.py" similarity index 100% rename from "1\354\243\274\354\260\250/2741-N \354\260\215\352\270\260.py" rename to "1week/2741-N \354\260\215\352\270\260.py" diff --git "a/1\354\243\274\354\260\250/2742-\352\270\260\354\260\215 N.py" "b/1week/2742-\352\270\260\354\260\215 N.py" similarity index 100% rename from "1\354\243\274\354\260\250/2742-\352\270\260\354\260\215 N.py" rename to "1week/2742-\352\270\260\354\260\215 N.py" diff --git "a/1\354\243\274\354\260\250/8393-\355\225\251.py" "b/1week/8393-\355\225\251.py" similarity index 100% rename from "1\354\243\274\354\260\250/8393-\355\225\251.py" rename to "1week/8393-\355\225\251.py" From 21928c41caa3f245b6ea45e0c4f92272aadba999 Mon Sep 17 00:00:00 2001 From: sumin Date: Mon, 25 Nov 2024 16:00:57 +0900 Subject: [PATCH 2/2] 3week --- ...0 \352\265\254\355\225\230\352\270\260.py" | 9 ++++++ ...4\354\210\230 \354\260\276\352\270\260.py" | 10 +++++++ "3week/10280-\354\212\244\355\203\235.py" | 24 +++++++++++++++ "3week/10773-\354\240\234\353\241\234.py" | 11 +++++++ "3week/10845-\355\201\220.py" | 30 +++++++++++++++++++ "3week/10866-\353\215\261.py" | 26 ++++++++++++++++ ...\354\212\244 \353\254\270\354\240\2340.py" | 17 +++++++++++ "3week/18258-\355\201\2202.py" | 30 +++++++++++++++++++ "3week/2164-\354\271\264\353\223\2342.py" | 14 +++++++++ "3week/9012-\352\264\204\355\230\270.py" | 19 ++++++++++++ 10 files changed, 190 insertions(+) create mode 100644 "2week/1929-\354\206\214\354\210\230 \352\265\254\355\225\230\352\270\260.py" create mode 100644 "2week/1978-\354\206\214\354\210\230 \354\260\276\352\270\260.py" create mode 100644 "3week/10280-\354\212\244\355\203\235.py" create mode 100644 "3week/10773-\354\240\234\353\241\234.py" create mode 100644 "3week/10845-\355\201\220.py" create mode 100644 "3week/10866-\353\215\261.py" create mode 100644 "3week/11866-\354\232\224\354\204\270\355\221\270\354\212\244 \353\254\270\354\240\2340.py" create mode 100644 "3week/18258-\355\201\2202.py" create mode 100644 "3week/2164-\354\271\264\353\223\2342.py" create mode 100644 "3week/9012-\352\264\204\355\230\270.py" diff --git "a/2week/1929-\354\206\214\354\210\230 \352\265\254\355\225\230\352\270\260.py" "b/2week/1929-\354\206\214\354\210\230 \352\265\254\355\225\230\352\270\260.py" new file mode 100644 index 0000000..1d08753 --- /dev/null +++ "b/2week/1929-\354\206\214\354\210\230 \352\265\254\355\225\230\352\270\260.py" @@ -0,0 +1,9 @@ +M,N = map(int,input().split()) +for i in range(M,N+1): #9 + if i ==1: + continue + for j in range(2,i): #2345678 + if i % j == 0: #9/2 + break + else: + print(i) diff --git "a/2week/1978-\354\206\214\354\210\230 \354\260\276\352\270\260.py" "b/2week/1978-\354\206\214\354\210\230 \354\260\276\352\270\260.py" new file mode 100644 index 0000000..4bec0de --- /dev/null +++ "b/2week/1978-\354\206\214\354\210\230 \354\260\276\352\270\260.py" @@ -0,0 +1,10 @@ +num = input() +M,N = map(int,input().split()) +for i in range(M,N+1): #9 + if i ==1: + continue + for j in range(2,i): #2345678 + if i % j == 0: #9/2 + break + else: + print(len(i)) diff --git "a/3week/10280-\354\212\244\355\203\235.py" "b/3week/10280-\354\212\244\355\203\235.py" new file mode 100644 index 0000000..4264920 --- /dev/null +++ "b/3week/10280-\354\212\244\355\203\235.py" @@ -0,0 +1,24 @@ +import sys +n = int(sys.stdin.readline()) + +stack = [] +for i in range(n): + command = sys.stdin.readline().split() + + if command[0] == 'push': + stack.append(command[1]) + + elif command[0] == 'pop': + if len(stack)==0: + print(-1) + else: + print(stack.pop()) + + elif command[0] == 'size': + print(len(stack)) + + elif command[0] == 'empty': + if len(stack)==0: + print(1) + else: + print(0) \ No newline at end of file diff --git "a/3week/10773-\354\240\234\353\241\234.py" "b/3week/10773-\354\240\234\353\241\234.py" new file mode 100644 index 0000000..d256944 --- /dev/null +++ "b/3week/10773-\354\240\234\353\241\234.py" @@ -0,0 +1,11 @@ +cnt = int(input()) +list = [] +for i in range(cnt): + num = int(input()) + if num == 0 : + list.pop() + else: + list.append(num) + + +print(sum(list)) \ No newline at end of file diff --git "a/3week/10845-\355\201\220.py" "b/3week/10845-\355\201\220.py" new file mode 100644 index 0000000..61c844b --- /dev/null +++ "b/3week/10845-\355\201\220.py" @@ -0,0 +1,30 @@ +import sys + +N = int(sys.stdin.readline()) + +queue = [] + +for i in range(N): + cmd = sys.stdin.readline().split() + + if cmd[0] == "push": + queue.insert(0, cmd[1]) + + elif cmd[0] == "pop": + if len(queue) != 0: print(queue.pop()) + else: print(-1) + + elif cmd[0] == "size": + print(len(queue)) + + elif cmd[0] == "empty": + if len(queue) == 0: print(1) + else : print(0) + + elif cmd[0] == "front": + if len(queue) == 0: print(-1) + else: print(queue[len(queue) -1]) + + elif cmd[0] == "back": + if len(queue) == 0: print(-1) + else: print(queue[0]) \ No newline at end of file diff --git "a/3week/10866-\353\215\261.py" "b/3week/10866-\353\215\261.py" new file mode 100644 index 0000000..e96cc9e --- /dev/null +++ "b/3week/10866-\353\215\261.py" @@ -0,0 +1,26 @@ +import sys +input = sys.stdin.readline + +n = int(input()) + +cmd = [input() for _ in range(n)] + +deque = [] + +for c in cmd: + if 'push_front' in c.split()[0]: + deque.insert(0, c.split()[1]) + elif 'push_back' in c.split()[0]: + deque.append(c.split()[1]) + elif 'pop_front' in c: + print(deque.pop(0)) if deque else print(-1) + elif 'pop_back' in c: + print(deque.pop(-1)) if deque else print(-1) + elif 'size' in c: + print(len(deque)) + elif 'empty' in c: + print(0) if deque else print(1) + elif 'front' in c: + print(deque[0]) if deque else print(-1) + elif 'back' in c: + print(deque[-1]) if deque else print(-1) diff --git "a/3week/11866-\354\232\224\354\204\270\355\221\270\354\212\244 \353\254\270\354\240\2340.py" "b/3week/11866-\354\232\224\354\204\270\355\221\270\354\212\244 \353\254\270\354\240\2340.py" new file mode 100644 index 0000000..1148ee0 --- /dev/null +++ "b/3week/11866-\354\232\224\354\204\270\355\221\270\354\212\244 \353\254\270\354\240\2340.py" @@ -0,0 +1,17 @@ +import sys +from collections import deque +n, k = map(int, sys.stdin.readline().split()) +d=deque() +res=[] +for i in range(1, n+1): + d.append(i) +while len(d)!=0: + for _ in range(k-1): + d.append(d.popleft()) + res.append(d.popleft()) +print('<', end='') +for i in range(len(res)): + if i==len(res)-1: + print(res[i],end='>') + else: + print(res[i], end=', ') \ No newline at end of file diff --git "a/3week/18258-\355\201\2202.py" "b/3week/18258-\355\201\2202.py" new file mode 100644 index 0000000..61c844b --- /dev/null +++ "b/3week/18258-\355\201\2202.py" @@ -0,0 +1,30 @@ +import sys + +N = int(sys.stdin.readline()) + +queue = [] + +for i in range(N): + cmd = sys.stdin.readline().split() + + if cmd[0] == "push": + queue.insert(0, cmd[1]) + + elif cmd[0] == "pop": + if len(queue) != 0: print(queue.pop()) + else: print(-1) + + elif cmd[0] == "size": + print(len(queue)) + + elif cmd[0] == "empty": + if len(queue) == 0: print(1) + else : print(0) + + elif cmd[0] == "front": + if len(queue) == 0: print(-1) + else: print(queue[len(queue) -1]) + + elif cmd[0] == "back": + if len(queue) == 0: print(-1) + else: print(queue[0]) \ No newline at end of file diff --git "a/3week/2164-\354\271\264\353\223\2342.py" "b/3week/2164-\354\271\264\353\223\2342.py" new file mode 100644 index 0000000..0be3aec --- /dev/null +++ "b/3week/2164-\354\271\264\353\223\2342.py" @@ -0,0 +1,14 @@ +nums = int(input()) +card = [] +ans = [] + +for i in range(1, nums+1): + card.append(i) + +while (len(card) != 0): + ans.append(card.pop(0)) + if(len(card) != 0): + card.append(card.pop(0)) + +for j in ans: + print(j, end =" ") \ No newline at end of file diff --git "a/3week/9012-\352\264\204\355\230\270.py" "b/3week/9012-\352\264\204\355\230\270.py" new file mode 100644 index 0000000..9f28a00 --- /dev/null +++ "b/3week/9012-\352\264\204\355\230\270.py" @@ -0,0 +1,19 @@ +T = int(input()) + +for i in range(T): + stack = [] + a=input() + for j in a: + if j == '(': + stack.append(j) + elif j == ')': + if stack: + stack.pop() + else: + print("NO") + break + else: + if not stack: + print("YES") + else: + print("NO") \ No newline at end of file