-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeForces-1167A.py
More file actions
43 lines (36 loc) · 864 Bytes
/
CodeForces-1167A.py
File metadata and controls
43 lines (36 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Node:
def __init__(self,head,next = None) -> None:
self.head = head
self.next = next
def count_len(head):
total = 0
current = head
while current:
total+=1
current = current.next
print(total)
def create_linked_list(s):
head = Node(s[0])
current = head
for char in s[1:]:
new_node = Node(char)
current.next = new_node
current = new_node
return head
def solve(n,s):
head = create_linked_list(s)
current = head
index = 0
while current:
if current.head == '8':
remaining = n-index
if remaining>=11:
print('YES')
return
current = current.next
index+=1
print('NO')
for _ in range(int(input())):
n = int(input())
s = input().strip()
solve(n,s)