---
# System prepended metadata

title: '[Kattis] Friday the 13th 中文翻譯'
tags: [kattis, 中文翻譯]

---

# [Kattis] Friday the 13th

>題目連結:https://open.kattis.com/problems/friday 

 On the planet Htrae Friday the 13th is a lucky day. You are going there on the next space ship and want to calculate how many times it happens during a given year. Unfortunately they change their calendar every year. Every year starts on a Sunday, but other than that, they change everything. They have released a list of calendar specifications for the next few years. A calendar specification consists of the total number of days in the year, the number of months in the year, and the number of days in each of the months.
:::success
在星球Htrae上，星期五13號是個幸運日。你將在下一艘太空船上前往那裡，並想要計算在給定的一年內它會發生多少次。不幸的是，他們每年都更改他們的日曆。每一年都是以星期日開始，但除此之外，他們會改變所有的事情。他們已經發布了未來幾年的日曆規格清單。日曆規格包括一年中的總天數，一年中的月份數以及每個月的天數。
:::
 Your task is to figure out how many times there will be Friday the 13th based on the calendar specifications.
:::success
你的任務是根據日曆規格，計算星期五13號會出現多少次。
:::

 ## Input

 The first line of the input consists of a single integer, $T$, the number of test cases. The first line of each of the $T$ test cases is a line with two space separated integers, $D$ and $M$, the total number of days in the year and the number of months in the year respectively. The second line of each test case consists of $M$ space separated integers, $di$, the number of days in each month.
:::success
輸入的第一行包含一個整數$T$，表示測試案例的數量。每個$T$個測試案例的第一行是包含兩個以空格分隔的整數$D$和$M$，分別表示一年中的總天數和月份數。每個測試案例的第二行包含$M$個以空格分隔的整數$di$，表示每個月的天數。
:::
 - $1≤T≤20$ 
 - $1≤M≤D≤1000$ 
 - $1≤di≤100$ 
 - $∑(di)=D$ 

 ## Output

 For each test case, output the number of Friday the 13ths in the specified year.
:::success
對於每個測試案例，輸出指定年份中星期五13號出現的次數。
:::
 ### Sample Input 1

```
3
20 1
20
40 2
21 19
365 12
31 28 31 30 31 30 31 31 30 31 30 31
```
 
 ### Sample Output 1 

 
```
1
2
2
```
 ###### 翻譯錯誤請留言告知