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

DSPF28335:从零到一,实战GPIO与外部中断的嵌入式系统交互设计 本文以德州仪器DSPF28335芯片为例,详细讲解了嵌入式系统中GPIO与外部中断(EXTI)的实战配置方法。通过一个完整的按键控制LED并触发ADC采样的项目,深入剖析了GPIO寄存器配置、三级中断机制(外设-PIE-CPU)以及中断服务函数编写的核心要点,帮助开发者掌握嵌入式交互设计的基石,并提供了关键的避坑指南与调试清单。 阅读详情

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);
}


在实车上进行lio-sam测试 PS:将雷达和imu相对固定后,拆下来,原地晃啊晃,直到xyz进度达到百分百,参考gif。标定完成后,会在result文件夹下生成result.txt。 阅读详情

相关推荐

UE5游戏逆向实战:用FModel提取.pak文件中的3D模型(附Dumper-7避坑指南)

本文详细介绍了如何使用FModel工具从UE5游戏的.pak文件中提取3D模型,并提供了Dumper-7的避坑指南。内容涵盖FModel工具链配置、UE5特有的unversioned properties问题解决方案、Dumper-7实战流程以及模型后处理技巧,帮助开发者高效获取游戏资产。

weixin_30872499的博客 422

CODEFORCES --- 148A. Insomnia cure

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

weixin_45691078的博客 297

麒麟系统grub被锁怎么办?双密码遗忘救援指南(实测V10 SP3版本)

本文详细介绍了麒麟系统V10 SP3版本在GRUB和root密码双遗忘情况下的救援指南。通过ISO镜像进入救援模式,结合单用户模式操作,实现密码重置与系统权限恢复,特别适用于等保合规环境。

387

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

分布式推理服务(策略:数据并行、张量并行、流水线并行、专家并行)技术分析

摘要:分布式推理突破单GPU内存和算力限制,支持大模型部署。四种核心策略包括: 数据并行:复制模型拆分数据,提升吞吐但内存效率低; 流水线并行:模型分阶段执行,支持超大模型但存在计算气泡; 张量并行:拆分层内矩阵运算,延迟低但通信开销大; 专家并行:动态激活MoE模型专家,计算高效但路由复杂。实际应用中常组合策略(如3D并行),需权衡模型规模、硬件条件与性能目标。

技术引领业务创新 946

[Unity Demo]从零开始制作空洞骑士Hollow Knight第四集:制作更多的敌人

大家好久不见,终于放完中秋假期可以回自己家里打代码了,上一期我介绍了为什么和如何导入2D toolkit以及制作一个完整的敌人(就是那只蚊子包括了精灵,动画,状态机行为以及脚本)现在不妨趁热打铁制作更多的敌人。

dangoxiba的博客 1974

Codeforces Round 105

A B C E

原原的博客 385

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

2025电赛嵌入式:K210教程-如何刷固件 如何烧录代码 全网唯一

本文介绍了K210开发板的固件刷写和开发环境搭建方法。主要内容包括:1)从Sipeed官网下载合适的MaixPy固件,根据需求选择完整版或精简版;2)使用k-flash等工具烧录固件,注意区分亚博和Sipeed开发板的固件版本;3)介绍了擦除闪存的两种模式(部分擦除和完全擦除)及其应用场景;4)搭建CanMV开发环境,通过MaixPy IDE连接开发板并进行程序调试。文章还提供了常见问题的解决方法,如串口驱动安装、固件兼容性检查等,为K210开发提供了完整的入门指南。

FJN110的博客 547

iOS安全和逆向系列教程 第18篇:iOS应用脱壳技术详解与实战

iOS应用脱壳技术详解与实战 摘要: 本文深入剖析了iOS应用脱壳技术,首先解释了加壳(如FairPlay DRM)与脱壳的基本概念及必要性。通过otool命令可以检测应用的加密状态。文章详细介绍了三种主流脱壳工具:经典dumpdecrypted工具的使用方法、现代化Clutch工具的安装配置以及基于Frida的高级脱壳方案frida-ios-dump。针对特殊情况,还提供了使用LLDB手动dump内存的技术细节,包括查找基地址、计算dump范围和内存读取等操作。最后介绍了修复Mach-O文件头的Pytho

一个自学不成材的程序员 710

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

Yolov8轻量级网络:Ghostnet、G_ghost、Ghostnetv2家族大作战(一):华为Ghostnet,超越谷歌MobileNet | CVPR2020

Yolov8引入轻量级网络Ghostnet、G_ghost、Ghostnetv2等,减少最新的深度神经网络的计算成本,引入高效的神经网络结构。

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 2569

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

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

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

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

codeforces-148A. Insomnia cure-题解

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

金鳞踏雨 852

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

【水题】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、付费专栏及课程。

余额充值