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

CUDA编程 - Nsight system & Nsight compute 的安装和使用 - 学习记录 在 cuda 编程中,经常会用到 Nsight system 和 Nsight compute 进行性能分析等,下面做个学习总结。本篇包括安装和常用分析思路总结,具体实践操作总结会放在下一篇博客。 阅读详情

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


【高级雷达感知与学习】 第十三章 可解释性与物理–感知融合(Physics-Informed ML) 本文提出了一种面向雷达感知的物理约束学习方法,将雷达物理先验(RCS、SNR、距离衰减)嵌入神经网络,解决纯数据驱动模型的样本效率低、泛化能力弱和决策不可信问题。通过三种融合范式(混合建模、物理正则化、PINNs)实现机理与数据协同建模,并设计了物理引导显著图解决雷达可解释性语义错位问题。实验表明,物理约束可提升40%样本效率,增强低信噪比场景鲁棒性。代码实现包含物理正则化损失、可解释性分析和消融实验,为雷达感知系统提供了可迁移的工程范本。 阅读详情

相关推荐

多目标跟踪中使用trackeval评估dancetrack运行结果

trackeval使用

qq_46144849的博客 1783

CODEFORCES --- 148A. Insomnia cure

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

weixin_45691078的博客 297

Hexo博客使用PDF.js

clone了一个pdf.js 然后兴高采烈地到文章里使用{% pdf %}标签 结果浏览器弹出了个下载框(使用GitHub的raw) 不知道是不是因为使用GitHub的原因导致这个问题 后来我测试的时候报了个错 优快云上的解决方法 到时候我再试试把资源放回lib/里面看看行不行 目录1.clone1.1.官方方法1.2.NexT主题方法1.3.补充2.修改文件2.1.修改viewer.htm...

LTFan 962

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

QT+QGIS跨平台编译(基于Qt,采用一套代码、一套框架,完成QGIS第三方库、核心库、应用程序的跨平台编译)

QT+QGIS跨平台编译。 基于Qt,采用一套代码、一套框架,完成QGIS第三方库、核心库、应用程序的跨平台编译。

LuckyHanMo的博客 4379

【linux】linux 出现一个网卡绑定多个ip怎么处理

我的原因是我使用了dhcp,这个会自动分配ip, 将 BOOTPROTO 参数由 dhcp 改为 static,并移除或注释掉与动态分配地址 10.0.2.15 相关的配置行(如果存在)。执行后,您可以再次使用 ip -4 a 或 ifconfig 命令确认 IP 地址已被移除。输出可以看出,您的虚拟机(k8s003)中存在一个名为 enp0s3 的网卡绑定了多个 IPv4 地址。对于某些 Linux 发行版(如 Ubuntu、Debian),您可能需要编辑网络接口的配置文件来移除多余的 IP 地址。

九师兄 298

Codeforces Round 105

A B C E

原原的博客 385

华为od 面试八股文_前端_03_含答案

华为od 面试八股文_前端_03_含答案

MISAYAONE的博客 2130

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

【WRF-FDDA】观测 Obs nudging 的配置与使用说明(中)

WRF-FDDA

WW、forever的博客 282

PCL 最小生成树用于法向量定向【2025最新版】

PCL 最小代价生成树用于点云法向量的定向。博客长期更新,本文最近更新时间为:2025年9月15日。

点云侠的博客 2068

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

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

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

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

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

codeforces-148A. Insomnia cure-题解

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

金鳞踏雨 852

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

余额充值