CF93E.Lostborn

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 , 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.

伊戈尔·K 非常喜欢一款多人在线角色扮演游戏《WineAge II》。谁知道呢,这或许正是他大学成绩不佳的原因。和所有玩这款游戏的人一样,他也希望尽可能为自己的角色装备性能优异的武器与防具。

某天,他像往常一样浏览游戏论坛时,偶然发现了一个非常有趣的事实:原来游戏中每件武器都由 kk 个不同的数 a1,…,aka_1, \dots, a_k 刻画,这些数被称为“命中指标”,且按照游戏开发者的设定,它们两两互质。

一次攻击所造成的伤害不仅取决于武器本身的属性,还取决于角色的力量参数。因此,若角色的力量值为 nn,则此次攻击所造成的伤害即为区间 中不被任一命中指标 aia_i 整除的整数个数。

最近,伊戈尔·K 在完成另一项任务后,获得了一把全新的“遗民之剑”。他想知道,若使用这把剑,自己将对敌人造成多少伤害。

输入格式

The first line contains two integers: n and k (1 ≤ n ≤ 1013, 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.

第一行包含两个整数:nn 和 kk(1 ≤ n ≤ 10131 \leq n \leq 10^{13},1 ≤ k ≤ 1001 \leq k \leq 100)。它们分别表示 Igor K 的英雄的力量值和攻击指示符的个数。

第二行包含 kk 个用空格分隔的整数 aia_i(1 ≤ ai ≤ 10001 \leq a_i \leq 1000)。它们是 Lostborn 剑的攻击指示符。给定的 kk 个数两两互质。

输出格式

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.

输出单个数字——即伊戈尔·K 的英雄使用新武器时所造成的伤害值。

请注意,在 C++ 中不要使用 %lld 格式说明符来读取或写入 64 位整数。推荐使用 cin、cout 流,或使用 %I64d 格式说明符。

输入输出样例

  • 输入#1

    20 3
    2 3 5

    输出#1

    6
  • 输入#2

    50 2
    15 8

    输出#2

    41

输入解题思路,AI测评打分。不知道怎么写?

首页