ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

cf-----A. Insomnia cure

2019-06-10 11:50:05  阅读:303  来源: 互联网

标签:Insomnia cf dragons cure she th got dragon was


A. Insomnia cure
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
«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?

Input
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).

Output
Output the number of damaged dragons.

Examples
inputCopy
1
2
3
4
12
outputCopy
12
inputCopy
2
3
4
5
24
outputCopy
17
Note
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.

理解题意

满足被k,l,m,n,整除的d龙,既被伤害,计算被伤害的龙

AC代码

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,l,m,n,d;
	int count=0;
	cin>>k>>l>>m>>n>>d;
	for(int i=1;i<=d;i++)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0)
		{
			count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

标签:Insomnia,cf,dragons,cure,she,th,got,dragon,was
来源: https://blog.csdn.net/weixin_43400325/article/details/90037651

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有