From cf40dce705e35fe5808d497340c261296277cc6b Mon Sep 17 00:00:00 2001 From: fzorb Date: Sat, 10 May 2025 20:55:49 +0300 Subject: [PATCH] add 3032 (joc) --- 3032/solutie.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 3032/solutie.cpp diff --git a/3032/solutie.cpp b/3032/solutie.cpp new file mode 100644 index 0000000..1e4dca0 --- /dev/null +++ b/3032/solutie.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +ifstream fin("joc.in"); +ofstream fout("joc.out"); + +int main() { + int x, n, a=0, ant=0; + fin >> n >> x; + ant = x; + for (int i = 0; i < n; i++) { + fin >> a; + ant = x; + if (a == 1) { + x = x * 2; + } else if (a == 2) { + x = ant*3 + 1 + x; + } else if (a == 3) { + x = x / 2; + } + } + fout << x; + return 0; +}