300489: CF93E. Lostborn

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Lostborn

题意翻译

#### 题目描述 小Biu最近喜欢上一款角色扮演游戏,游戏中的每一款武器有 $ k $ 个参数 $ a_{1},...,a_{k} $ ,并且根据游戏说明,这些参数两两互质。 游戏中的主角为英雄,英雄发起攻击时,造成的伤害不仅与武器有关,还与英雄的力量有关。如果英雄的力量为 $ n $ ,那么一次攻击造成的伤害为区间 $[1,n]$ 中不能被武器参数整除的数的个数。 现在小Biu获得了一把新的武器装备,他想知道用某个英雄发起攻击时,造成的伤害值为多少。 #### 输入格式 第一行包含两个整数 $ n $ 和 $ k $ ( $ 1\le n\le 10^{13} $ , $ 1\le k\le 100 $ ),表示英雄的力量和装备的参数个数; 第二行包含 $ k $ 个整数 $ a_{i} $ ( $ 1\le a_{i}\le 1000 $ ),表示装备的每个参数,这些参数两两互质。 #### 输出格式 输出一个整数,表示造成的伤害值。

题目描述

Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible. One day, as he was reading the game's forum yet again, he discovered a very interesting fact. As it turns out, each weapon in the game is characterised with $ k $ different numbers: $ a_{1},...,a_{k} $ . They are called hit indicators and according to the game developers' plan they are pairwise coprime. The damage that is inflicted during a hit depends not only on the weapon's characteristics, but also on the hero's strength parameter. Thus, if the hero's strength equals $ n $ , than the inflicted damage will be calculated as the number of numbers on the segment ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF93E/7c9ede55f73532a1d6ca7574887c95534e61c3ff.png), that aren't divisible by any hit indicator $ a_{i} $ . Recently, having fulfilled another quest, Igor K. found a new Lostborn sword. He wants to know how much damage he will inflict upon his enemies if he uses it.

输入输出格式

输入格式


The first line contains two integers: $ n $ and $ k $ ( $ 1<=n<=10^{13} $ , $ 1<=k<=100 $ ). They are the indicator of Igor K's hero's strength and the number of hit indicators. The next line contains space-separated $ k $ integers $ a_{i} $ ( $ 1<=a_{i}<=1000 $ ). They are Lostborn sword's hit indicators. The given $ k $ numbers are pairwise coprime.

输出格式


Print the single number — the damage that will be inflicted by Igor K.'s hero when he uses his new weapon. Please, do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.

输入输出样例

输入样例 #1

20 3
2 3 5

输出样例 #1

6

输入样例 #2

50 2
15 8

输出样例 #2

41

Input

题意翻译

#### 题目描述 小Biu最近喜欢上一款角色扮演游戏,游戏中的每一款武器有 $ k $ 个参数 $ a_{1},...,a_{k} $ ,并且根据游戏说明,这些参数两两互质。 游戏中的主角为英雄,英雄发起攻击时,造成的伤害不仅与武器有关,还与英雄的力量有关。如果英雄的力量为 $ n $ ,那么一次攻击造成的伤害为区间 $[1,n]$ 中不能被武器参数整除的数的个数。 现在小Biu获得了一把新的武器装备,他想知道用某个英雄发起攻击时,造成的伤害值为多少。 #### 输入格式 第一行包含两个整数 $ n $ 和 $ k $ ( $ 1\le n\le 10^{13} $ , $ 1\le k\le 100 $ ),表示英雄的力量和装备的参数个数; 第二行包含 $ k $ 个整数 $ a_{i} $ ( $ 1\le a_{i}\le 1000 $ ),表示装备的每个参数,这些参数两两互质。 #### 输出格式 输出一个整数,表示造成的伤害值。

加入题单

算法标签: