F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

MG loves apple

Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 1632    Accepted Submission(s): 295


Problem Description
MG is a rich boy. He has $n$ apples, each has a value of V($0<=V<=9$).

A valid number does not contain a leading zero, and these apples have just made a valid $N$ digit number.

MG has the right to take away $K$ apples in the sequence, he wonders if there exists a solution: After exactly taking away $K$ apples, the valid $N-K$ digit number of remaining apples mod $3$ is zero.

MG thought it very easy and he had himself disdained to take the job. As a bystander, could you please help settle the problem and calculate the answer?
 

Input
The first line is an integer $T$ which indicates the case number.£¨$1<=T<=60$)

And as for each case, there are $2$ integer $N(1<=N<=100000)$,$K(0<=K$$<$$N)$ in the first line which indicate apple-number, and the number of apple you should take away.

MG also promises the sum of $N$ will not exceed $1000000$¡£

Then there are $N$ integers $X$ in the next line, the i-th integer means the i-th gold¡¯s value($0<=X<=9$).
 

Output
As for each case, you need to output a single line.

If the solution exists, print¡±yes¡±,else print ¡°no¡±.(Excluding quotation marks)
 

Sample Input
2 5 2 11230 4 2 1000
 

Sample Output
yes no
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 09:19:21, Gzip enabled