CF148A.Insomnia cure
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.
However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and she was fighting them off. Every k-th dragon got punched in the face with a frying pan. Every l-th dragon got his tail shut into the balcony door. Every m-th dragon got his paws trampled with sharp heels. Finally, she threatened every n-th dragon to call her mom, and he withdrew in panic.
How many imaginary dragons suffered moral or physical damage tonight, if the princess counted a total of d dragons?
“一只龙,两只龙,三只龙……”公主一边数着一边念叨。她一直难以入睡,九岁时就已厌倦了数绵羊。
然而,单纯地数龙也同样无聊,于是她尽其所能自娱自乐。今晚,她幻想所有龙都来抓她,而她则奋力反击:每第 k 只龙被她用平底锅猛击脸部;每第 l 只龙的尾巴被她夹在阳台门里;每第 m 只龙的爪子被她用尖头高跟鞋狠狠踩踏;最后,她威胁每第 n 只龙要叫她妈妈来,那只龙便惊恐地退缩了。
如果公主总共数了 d 只龙,那么今夜有多少只想象中的龙遭受了精神或肉体上的伤害?
输入格式
Input data contains integer numbers k, l, m, n and d, each number in a separate line (1 ≤ k, l, m, n ≤ 10, 1 ≤ d ≤ 105).
输入数据包含整数 k、l、m、n 和 d,每个数字占一行(1 ≤ k, l, m, n ≤ 10,1 ≤ d ≤ 10⁵)。
输出格式
Output the number of damaged dragons.
输出受损龙的数量。
输入输出样例
输入#1
1 2 3 4 12
输出#1
12
输入#2
2 3 4 5 24
输出#2
17
说明/提示
In the first case every first dragon got punched with a frying pan. Some of the dragons suffered from other reasons as well, but the pan alone would be enough.
In the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.
在第一种情况下,每条编号为1的龙都被平底锅击中。部分龙还因其他原因受伤,但仅平底锅一击就已足够。
在第二种情况下,编号为1、7、11、13、17、19和23的龙均未受伤而逃脱。
输入解题思路,AI测评打分。不知道怎么写?