CodeForces515C_Drazil and Factorial

Conda环境创建报错?教你快速解决Solving environment: failed和ResolvePackageNotFound问题 本文深入解析Conda环境创建中常见的'Solving environment: failed'和'ResolvePackageNotFound'报错原因,并提供从基础到高级的系统化解决方案。涵盖渠道配置、版本通配、环境文件编辑等实用技巧,帮助开发者快速解决conda环境创建问题,提升工作效率。 阅读详情
 Drazil and Factorial

time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Drazil is playing a math game with Varda.

Let's define  for positive integer x as a product of factorials of its digits. For example, .

First, they choose a decimal number a consisting of n digits that contains at least one digit larger than 1. This number may possibly start with leading zeroes. Then they should find maximum positive number x satisfying following two conditions:

1. x doesn't contain neither digit 0 nor digit 1.

2.  = .

Help friends find such number.

Input

The first line contains an integer n (1 ≤ n ≤ 15) — the number of digits in a.

The second line contains n digits of a. There is at least one digit in a that is larger than 1. Number a may possibly contain leading zeroes.

Output

Output a maximum possible integer satisfying the conditions above. There should be no zeroes and ones in this number decimal representation.

Examples
input
4
1234
output
33222
input
3
555
output
555
Note

In the first case, 

思路:

非质数阶乘可以分解为质数阶乘之积:9!=7!*3!*3!*2!等。

#include <stdio.h>
int main()
{
	int i = 0, j = 0, n = 0, sum[8] = { 0 };		//sum[2]:2	sum[3]:3	sum[5]:5	sum[7]:7
	char ch[20] = { 0 };
	scanf("%d", &n);
	getchar();
	for (i = 0;i < n;i++)
	{
		ch[i] = getchar();
		switch (ch[i])
		{
		case '2': {sum[2]++;break;}
		case '3': {sum[3]++;break;}
		case '4': {sum[3]++;sum[2] += 2;break;}
		case '5': {sum[5]++;break;}
		case '6': {sum[3]++;sum[5]++;break;}
		case '7': {sum[7]++;break;}
		case '8': {sum[7]++;sum[2] += 3;break;}
		case '9': {sum[7]++;sum[3] += 2;sum[2]++;break;}
		}
	}
	for (i = 7;i > 1;i--)
	{
		if (sum[i] != 0)
		{
			for (j = 0;j < sum[i];j++)
				printf("%d", i);
		}
	}
	printf("\n");
}

SHP转TXT、TXT转SHP工具(附工具下载链接) 关于TXT,可以选择整个图层生成一个TXT。也可以勾选“每个地块单独存TXT”,然后选择一个字段,根据字段值,给每个地块生成一个TXT文件。支持选择和数据框一样的坐标系,也可以选择一个图层,工具会采用和这个图层一样的坐标系。1、TXT数据支持输入单个或者多个TXT文件,也可以直接选择TXT所在的文件夹。所有的TXT数据都生成到一个矢量数据图层。关于这一行的内容,可以在地块坐标行设置中进行设置。其他:①面节点闭合:勾选,则回到起点。属性描述:可以直接复制粘贴进来,也可以直接修改。也可以改为任意字母。 阅读详情

相关推荐

用户行为数据分析 User Behavior Data from Taobao for Recommendation

一、提出问题 二、理解数据 数据来源 阿里云天池数据集:(https://tianchi.aliyun.com/dataset/dataDetail?dataId=649) 本文选取的数据集为UserBehavior.csv,共有5242880条数据。数据的具体类别如下表所示: 用户行为种类有四种,如下表所示 对于数据维度的说明如下: 在本文选取的2017年11月25日到2017年12月3日的时间范围内,不重复的用户数量为10202,不重复的商品ID数为412369,不重复的商品类目ID数为5859,

cccxxxqq的博客 5207

CF515C Drazil and Factorial

题目链接 https://codeforces.com/problemset/problem/515/C 题目描述 Drazil正在和Varda一起玩数学游戏。 让我们定义正整数x作为其数字的阶乘的乘积。例如,F(135)=1!*3!*5!=720。 首先,他们选择一个十进制数a,a是一个由n个数字组成的数。此数字可能以前导零开头。然后他们要找到最大正数x,x满足以下两个条件: 1.x不包含任何数字0和数字1。 2.F(x)=F(a)。 帮朋友找到这样的号码。 输入输出格式 输入格式: 第一行包含一个整数n

Zerotogether的博客 665

Sentinel-1 Burst数据处理避坑实录:从aria2c报错到wget脚本救场

本文详细介绍了Sentinel-1 Burst数据处理的完整解决方案,从下载困境到高效处理技巧。针对aria2c报错等常见问题,提供了增强版wget脚本和智能分组方法,显著提升下载成功率和处理效率,特别适合科研机构和企业级网络环境下的哨兵数据处理需求。

weixin_42641998的博客 284

C. Drazil and Factorial

Description Drazil is playing a math game with Varda. Let's define for positive integer x as a product of factorials of its digits. For example, . First, they choose a decimal number a consist

tydfhihfhgjkj的博客 494

AutosarMCAL开发——基于TC367、EBTresos 开发之PORT

下图为开漏输出与推挽输出电路区别,推挽输出有两个极性相反的mos构成,一个管子导通另一个管子关闭以实现输出高低电平(电流较小不具备驱动能力),开漏输出仅使用一个MOS管,所以在这种模式下只能输出低电平,想要输出高电平需要外部提供(输入电流不可超过引脚最大电流显示否则会烧MCU)开漏输出:输出寄存器为低电平时,经过输出控制电路变成一个高电平,N-MOS导通,低电平从I/O引脚输出,输出寄存器为高电平时,P-MOS和N-MOS都是截止状态,电平无法通过,想要输出高电平需要外接上拉电阻。

qq_45583706的博客 1406

基于深度学习的生活垃圾检测与分类系统:YOLOv5、YOLOv6、YOLOv7与YOLOv8实现

本项目的目标是开发一个基于YOLO系列模型的生活垃圾检测与分类系统。数据集准备与标注:收集并标注生活垃圾图像数据集。模型训练:使用YOLOv5、YOLOv6、YOLOv7、YOLOv8等深度学习模型训练垃圾分类系统。UI界面设计:设计一个简洁的用户界面,支持图像或视频的上传与垃圾分类结果展示。实时垃圾检测与分类:通过摄像头进行实时垃圾检测和分类。结果展示与保存:展示检测结果,支持用户保存分类后的图像或视频。

YOLO 705

Drazil and Factorial - CodeForces 513 C 水题

Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil is playing a math game with Var

提比的强行AC 1312

目前固态激光雷达在机器人领域的应用难点汇总

固态激光雷达在机器人领域面临性能与成本的双重挑战:探测性能上,动态范围不足(60-80dB)导致高/低反射物体识别困难,近距盲区(30-50cm)与长距精度(±3cm)矛盾突出;结构上视场角与点云密度难以平衡,多雷达拼接又带来同步误差。成本方面,核心元件(SPAD/OPA芯片)良率低(<50%)、校准工序复杂,单机成本超200美元。环境适应性上,粉尘附着、振动偏移(±2°)和光衰(1万小时衰减15%)制约可靠性。

start_up_go的博客 483

515C. Drazil and Factorial

C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil is playing a math game with Varda. Le

章鱼小丸子 650

WS2812和homeassistant握手

本文学习了WS2812和homeassistant握手,后期会分享更多有趣物联网的操作从而实现对外部世界进行感知,充分认识这个有机与无机的环境,科学地合理地进行创作和发挥效益,然后为人类社会发展贡献一点微薄之力。...

vor234的博客 816

C++程序无法正常启动(报0xc000007b错误)问题的详细排查

本文详细介绍了应用程序启动时遇到0xC000007B错误的排查过程。问题源于32位程序与64位运行时库的不匹配,以及缺少依赖的运行时库。通过分析系统日志、使用Windbg和检查程序位数,最终确定问题在于32位程序误引用了64位系统目录下的库文件。

dvlinker的技术专栏 1万+

【codeforces 515C】Drazil and Factorial

【题目链接】:http://codeforces.com/contest/515/problem/C 【题意】 定义f(n)=n这个数各个位置上的数的阶乘的乘积; 给你a; 让你另外求一个不含0和1的最大的数字b; 使得f(a)==f(b) 【题解】 对a的每一个大于1的数字进行分解; 看看它能够组合成的最多的比它小的数字的阶乘的乘积是哪些;...

188

激光除草技术原理与应用全解析

激光除草技术通过光热、光化学等效应精准破坏杂草组织,核心参数包括功率(20-6000W)、波长(400nm-10.6μm)和脉冲宽度。主要应用于大田作物(如玉米、棉花)、经济作物(烟草、果树)及城市绿化,具有环保(无化学污染)、高效(识别率≥95%)和非接触等优势,但存在设备成本高(20-50万元)、技术门槛高等局限。当前技术融合AI识别、多光谱协同等创新,国产设备如华工智耘已实现95.3%识别精度。虽短期投入较高,但长期可降低30%除草成本,并带来环境效益(每亩减排1.2吨CO₂)

start_up_go的博客 558

codeforces 515C Drazil and Factorial

点击打开链接 C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil is pla

zhang__liuchen的博客 417

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

codeforces 515c Drazil and Factorial 分类讨论

题意: 略 思路: 每个阶乘肯定是分得越多个阶乘数就越好。 分类讨论。 1. 0和1直接忽略。 2. { 2,3,5,7 }这些数的阶乘是不能再分得,原数即可。 3.   4:{3, 2, 2},6:{5, 3}  8:{7, 2, 2, 2} 9:{7, 3, 3, 2}。 code: #include using namespace std; int n; string s

720

ssm框架搭建

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

codeforces 515C. Drazil and Factorial

题目链接:http://codeforces.com/problemset/problem/515/C题目意思:给出含有 n 个只有阿拉伯数字的字符串a(可能会有前导0),设定函数F(a) = 每个数字的阶乘乘积。例如 F(135) = 1! * 3! * 5! 。需要找出 x,使得F(x) = F(a),且组成 x 的数字中没有0和1。求最大的 x 为多少。 这个我是看了每个数字的转换才知道怎么做

long-long-ago 597

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Codeforces 515C Drazil and Factorial

Drazil is playing a math game with Varda. Let's define  for positive integer x as a product of factorials of its digits. For example, . First, they choose a decimal number a consisting of n di

XDU_PYL的博客 701

codeforces 515C. Drazil and Factorial 解题报告

题目链接:http://codeforces.com/problemset/problem/515/C 题目意思:给出含有n 个只有阿拉伯数字的字符串a(可能会有前导0),设定函数F(a) = 每个数字的阶乘乘积。例如 F(135) = 1! *3! * 5!。需要找出 x,使得F(x) = F(a),且组成 x 的数字中没有0和1。求最大的 x 为多少。   这个我是看了每个数字的转换...

weixin_30852451的博客 174

CodeForces 515C. Drazil and Factorial

C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil is playing a math game with Va...

weixin_33872566的博客 152

codeforces 515C C. Drazil and Factorial(水题,贪心)

题目链接: C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil is playing a math game with Var...

weixin_30622181的博客 118

http://codeforces.com/problemset/problem/515/C Drazil and Factorial

先将其中的所有阶乘中的数全部拆成质数相乘,为了使得长度最长,自然是只选择质数的阶乘可达到最长,因此每次都用质数的阶乘即可。 #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstdio&gt; #include &lt;algorithm&gt; #include &lt;vector&gt; #include &lt...

Jack_zhuiyi的博客 235

Codeforces Round #292 (Div. 2) C. Drazil and Factorial 515C

C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil is playing a math game with Vard...

weixin_30279671的博客 130

Codeforce 515 C . Drazil and Factorial 规律

传送门:http://codeforces.com/contest/515/problem/C C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard

阑珊记忆 1399

codeforces#292-C - Drazil and Factorial-数学规律题

http://codeforces.com/contest/515/problem/C 题意:给你一个n位的数字X,把他的每一位求阶乘累乘得到一个值F(X) 让你找一个最大的数a,满足: 1. x doesn't contain neither digit 0 nor digit 1. 2.  = . 如n=4;X=1234,则a=33222,因为 思路:

缺氧 669
上一篇: HDU5640_King's Cake
下一篇: POJ3617_Best Cow Line
ZayneHuang
博客等级 码龄10年 5粉丝 116原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值