Codeforces Round #105 (Div. 2) / 148A Insomnia cure (枚举 || 数论)

数据行小于列索引,内部模式表示可能存在问题 通过检查数据源的完整性和一致性,检查Debezium配置,检查列映射以及启用调试模式和日志记录,您应该能够解决这个错误。请注意,具体的解决方法可能因您的具体情况而异,因此您可能需要根据问题的根本原因进行适当的调整和修复。如果问题仍然存在,您可能需要进一步检查您的数据和配置,并根据具体情况进行调整和修复。在Debezium中,您可以使用列重命名和列映射来定义源和目标之间的列映射关系。通过检查日志,您可以查看详细的错误信息和堆栈跟踪,从而更好地理解问题的根本原因。首先,我们应该检查数据源的完整性和一致性。 阅读详情

A. Insomnia cure
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard 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.

Sample test(s)
input
1
2
3
4
12
output
12
input
2
3
4
5
24
output
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.


暴力代码:

/*30ms,0KB*/

#include <cstdio>

int main(void)
{
	int k, l, m, n, d, s = 0;
	scanf("%d%d%d%d%d", &k, &l, &m, &n, &d);
	for (int i = 1; i <= d; ++i)
		if (!(i % k && i % m && i % n && i % l))
			s++;
	printf("%d\n", s);
	return 0;
}


神牛写的数论代码:(没看懂)

/*30ms,0KB*/

#include <cstdio>
#include <vector>
using namespace std;

int v[4], n;
bool bio[4][4];

inline int gcd(int a, int b)
{
	int ret = 1;
	for (int i = 2; i <= a; ++i)
		if (a % i == 0 && b % i == 0)
			ret = i;
	return ret;
}

inline int lcm(int a, int b)
{
	return a / gcd(a, b) * b;///为防止可能的数据超范围,先除再乘要更好。
}

vector<int> rek(int i, int k, vector<int> w)
{
	if (k == 0)
	{
		int ret = w[0];
		for (int j = 1; j < (int) w.size(); ++j)
			ret = lcm(ret, w[j]);
		return vector<int> (1, ret);
	}
	if (i == 4)
        return vector<int>();
	vector<int> ret;
	vector <int> ret2 = rek(i + 1, k, w);
	for (int j = 0; j < (int)ret2.size(); ++j)
		ret.push_back(ret2[j]);
	w.push_back(v[i]);
	vector<int> ret1 = rek(i + 1, k - 1, w);
	for (int j = 0; j < (int)ret1.size(); ++j)
		ret.push_back(ret1[j]);
	return ret;
}

int main(void)
{
	int ret = 0;
	scanf("%d%d%d%d%d", &v[0], &v[1], &v[2], &v[3], &n);
	for (int i = 1; i <= 4; ++i)
	{
		vector<int> div = rek(0, i, vector<int>());
		for (int j = 0; j < (int)div.size(); ++j)
			if (i % 2)
				ret += n / div[j];
			else
				ret -= n / div[j];
	}
	printf("%d",ret);
}


⚡【C++要笑着学】(13) STL介绍:什么是STL标准模板库 | STL的版本 | 浅谈STL的缺陷 再讲解函数模板之前先对STL做一个小铺垫,本篇将对STL做一个简单的介绍。 阅读详情

相关推荐

WGCNA样本量不够怎么办?5种替代方案帮你解决小样本基因共表达分析难题

本文针对WGCNA样本量不足的问题,提供了5种科学替代方案,包括CEMiTool、参数调整、多组学数据整合、机器学习特征提取和公共数据利用。这些方法帮助研究者在小样本条件下仍能进行可靠的基因共表达分析,特别适用于罕见病和珍贵临床样本研究。

weixin_42554042的博客 304

CODEFORCES --- 148A. Insomnia cure

然而,光是数龙也很无聊,所以她充其量地自娱自乐。今晚她想象所有的龙都来偷她,她正在击退它们。在第一种情况下,每条龙都会被煎锅打一拳。有些龙也遭受了其他原因的折磨,但仅平底锅就足够了。三龙»,——公主在数。她难以入睡,九岁时就厌倦了数羊羔。都把尾巴关在阳台门上。每m条龙的爪子都被锋利的高跟鞋踩踏。在第二种情况下,龙1、7、11、13、17、19和23毫发无伤地逃脱了。条龙,今晚有多少想象中的龙遭受了精神或身体上的伤害?n条龙都叫她妈妈,他惊慌失措地退了出去。条龙都被煎锅打了一拳。如果公主数一数总共有。

weixin_45691078的博客 297

从勒索软件攻击到数据重生:SQL Server MDF文件修复的实战生存指南

本文详细介绍了SQL Server MDF文件在遭遇勒索软件攻击后的修复策略,重点解析了Recovery Toolbox工具链的应用流程。从灾难评估到数据验证,提供分阶段修复操作、高级修复技术及防御加固方案,帮助企业快速恢复数据库并提升安全防护能力。

weixin_28327051的博客 715

A. Insomnia cure

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 la

AlberTesla的博客 1351

乐视三合一体感摄像头--基本信息及windows下部分开发

乐视三合一体感摄像头--基本信息及windows下部分开发Introduction基本信息Windows下使用安装驱动使用openNI使用imageJ调用RGB图像Q:参考资料 Introduction       乐视三合一体感摄像头是乐视对标kinect,做的一款3D体感摄像头;设计目的为用于电视机上体感使用的,包括其USB结构都是为了符合电视机直接操作的,同时是支持相应的游戏操作;但是自从乐视倒闭之后,价格从之前标价899降到了现在140+左

GRF-Sunomikp31 1万+

关于Win11安装Ubuntu子系统报错:WslRegisterDistribution failed with error 解决办法

Win11安装Ubuntu子系统报错:WslRegisterDistribution failed with error

qq_51908382的博客 3万+

Codeforces Round 105

A B C E

原原的博客 385

深度拆解 ‘High-Frequency Trading’ (HFT) 系统:解析如何在 100 纳秒内完成从网卡到 C++ 策略的响应

在100纳秒内完成从网卡到C++策略的响应,这是一项对技术栈每一个层面都进行极限优化的系统工程。它要求我们深入理解计算机体系结构、操作系统、网络协议和C++语言的底层机制。从物理距离的极致缩短,到高性能网卡和内核旁路技术,再到C++代码中每一个字节、每一个CPU周期的精打细算,HFT系统展现了人类对计算速度的永恒追求。这项技术不仅仅应用于金融交易,其背后的低延迟理念和实现方法,如DPDK、无锁编程、硬件加速等,正在逐渐渗透到其他对延迟敏感的领域,例如电信网络、边缘计算和工业自动化。

weixin_41455464的博客 1039

Problem--148A--Codeforces--A. Insomnia cure

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 w

qq_36667106的博客 907

Xilinx FPGA平台DDR3设计保姆式教程(3)MIG IP核使用教程及DDR读写时序

干货来了,用DDR搬砖,只需要会用IP就好,Xilinx官方YYDS! ----------------------------------------------------------------------------------------------------------------- 汇总篇: Xilinx平台DDR3设计保姆式教程(汇总篇)——看这一篇就够了 ----------------------------------------------------------...

数字IC/FPGA杂货铺,找一找,或许有你想要的~ 2万+

黑猫带你学Nand第11篇:万字长文带你了解NandFlash的数据保持原理及特性(Data Retention)

TATTAT:Trap-assistedtunneling,陷阱辅助隧穿,也有叫法称为电荷陷阱现象。这是一种物理现象,它发生在非挥发性存储器,如NAND闪存。在这种效应中,存储在闪存单元浮动栅极上的电荷(电子)由于隧道氧化物中捕获的电荷形成的电场影响,导致电荷通过隧道效应从一个能级隧穿到另一个能级,从而造成电荷泄漏。这种电荷泄漏是导致闪存数据保持问题的主要原因之一,因为它可以改变存储在闪存单元中的电荷量,进而改变其阈值电压水平,最终可能导致数据错误。在NANDFlash中,电荷被存储在浮置栅极上。

黑猫奥利奥的博客 1102

codeforces 105 div2 A

A. Insomnia cure time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «One dragon. Two dragon. Three dragon», —

丿聪丶 741

2022年全国职业院校技能大赛网络系统管理赛项模块A:网络构建(样题5)-网络部分解析-附详细代码

2022年全国职业院校技能大赛网络系统管理赛项模块A:网络构建(样题5)-网络部分解析-附详细代码

bfq05234214的博客 416

Codeforces Round #105 (Div. 2)A

A. Insomnia curetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs w

qq_62079079的博客 273

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Insomnia cure

文章目录一、Insomnia cure总结 一、Insomnia cure 本题链接:Insomnia cure 题目: 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. S.

佛系更新 711

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

codeforces-148A. Insomnia cure-题解

题目大意: 公主晚上睡不着,想到了一个数龙的方法让自己睡着,但是仅仅数龙也很无聊,她想尽可能地娱乐自己。今晚,她想象着所有的龙都在她搏斗。每k-th条龙都被一只煎锅打在脸上,每l-th条龙的尾巴都被关在阳台的门里,每m-th条龙的爪子都被锋利的脚后跟踩着,最后,她威胁每n-th条龙叫她妈妈。如果公主数出d条龙的总数,那么今晚有多少条想象中的龙受到了精神或肉体上的伤害? 输入数据包含整数k, l...

金鳞踏雨 852

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

【水题】CodeForces - 148A Insomnia cure

Problem Description 输入k,l,m,n,d。d代表dragon的数量。不满足k,l,m,n倍数的恐龙不能消除。让你求最多能消除几只龙 代码:#include<bits/stdc++.h> using namespace std; int main() { int a, b, c, d; while(~scanf("%d %d %d %d", &a, &b, &

ACMer 梁剑锋 的博客 582

codeforces-148A-Insomnia cure

148A-Insomnia cure

Linoy 1308

CodeForces-148A-Insomnia cure

A. Insomnia cure time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «One dragon. Two dragon. Three dragon», —

Spikerman的专栏 786

Codeforces刷题之路——148A Insomnia cure

A. Insomnia cure time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «One dragon. Two dragon. Three dragon», —

莫欺少年穷 923

CF148 A Insomnia cure

«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 a

Kelisiya 573

Insomnia cure CodeForces - 148A (数论的扩展解法)

«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 a

SunMoonVocano的博客 669

Insomnia 替代 postman

http://gd.greenxf.com:8099/macsoft/Insomnia(www.greenxf.com).dmg

gwdgwd123的博客 3258

CodeForce 148A Insomnia cure(筛法)

«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. Ton

Jacob0824的博客 310
上一篇: Codeforces Beta Round #91 (Div. 2) / 122A Lucky Division (数论)
下一篇: 一、初级篇——指针(*)、取地址(&)、解引用(*)与引用(&)的区别
synapse7
博客等级 码龄14年 432粉丝 701原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值