ACM Training Session 2024.3 -- Solutions
Difference between en1 and en2, changed 0 character(s)
### [A. Collatz Algorithm](https://codeforces.me/group/e8jUNwDnHj/contest/504495/problem/A)↵

<spoiler summary="Solution">↵
```python↵
def read():↵
    return int(input())↵
def read_list():↵
    return [int(i) for i in input().split()]↵

n = read()↵
print(n, end=' ')↵
 ↵
while n != 1:↵
    if n % 2 == 0: ↵
        n //= 2↵
    else: ↵
        n *= 3↵
        n += 1↵
    print(n, end=' ')↵
```↵
</spoiler>↵


### [B. DNA Counting](https://codeforces.me/group/e8jUNwDnHj/contest/504495/problem/B)↵

<spoiler summary="Solution">↵
```python↵
def read():↵
    return int(input())↵
def read_list():↵
    return [int(i) for i in input().split()]↵
 ↵
 ↵
 ↵
s = input()↵
count = {}↵
a = "ACGT"↵
for c in a:↵
    count[c] = 0↵
for c in s:↵
    count[c] += 1↵

for c in a:↵
    print(count[c], end=' ')↵
```↵
</spoiler>↵

### [C. TPCP 2023 – Is it a Helal Sequence?](https://codeforces.me/group/e8jUNwDnHj/contest/504495/problem/C)↵

<spoiler summary="Solution">↵
```python↵
def read():↵
    return int(input())↵
def read_list():↵
    return [int(i) for i in input().split()]↵
 ↵
 ↵
n, x = read_list()↵
a = read_list()↵
 ↵
result = 1↵
for i in a:↵
    result *= i↵
    result %= x↵
 ↵
if result == 0:↵
    print("yes")↵
else:↵
    print("no")↵
```↵
</spoiler>↵



History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ammar007 2024-02-24 01:28:07 0 (published)
en1 English ammar007 2024-02-24 01:26:49 1310 Initial revision (saved to drafts)