Codeforces Round #292 (Div. 1)---A. Drazil and Factorial

Codeforces Round #240 (Div. 1)B---Mashmokh and ACM(水dp) Mashmokh’s boss, Bimokh, didn’t like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh’s team. I 阅读详情

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.
Sample test(s)
Input

4
1234

Output

33222

Input

3
555

Output

555

Note

In the first case,

水题,
将阶乘分解成素数的阶乘即可

/*************************************************************************
    > File Name: cf292-A.cpp
    > Author: ALex
    > Mail: zchao1995@gmail.com 
    > Created Time: 2015年02月18日 星期三 00时26分55秒
 ************************************************************************/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const double eps = 1e-15;
typedef long long LL;
typedef pair <int, int> PLL;

char str[20];
int num[10];

int main ()
{
    int n;
    while (~scanf("%d", &n))
    {
        scanf("%s", str);
        memset (num, 0, sizeof(num));
        int len = strlen (str);
        for (int i = 0; i < len; ++i)
        {
            if (str[i] == '0' || str[i] == '1')
            {
                continue;
            }
            else if (str[i] == '2' || str[i] == '3' || str[i] == '5' || str[i] == '7')
            {
                num[str[i] - '0']++;
            }
            else if (str[i] == '4')
            {
                num[2] += 2;
                num[3]++;
            }
            else if (str[i] == '6')
            {
                num[5]++;
                num[3]++;
            }
            else if (str[i] == '8')
            {
                num[7]++;
                num[2] += 3;
            }
            else
            {
                num[7]++;
                num[3] += 2;
                num[2]++;
            }
        }
        for (int i = 9; i >= 2; --i)
        {
            for (int j = 1; j <= num[i]; ++j)
            {
                printf("%d", i);
            }
        }
        printf("\n");
    }
    return 0;
}
Codeforces Round #169 (Div. 2)---C. Little Girl and Maximum Sum(简单贪心) The little girl loves the problems on array queries very much.One day she came across a rather well-known problem: you’ve got an array of n elements (the elements of the array are indexed starting from 阅读详情

相关推荐

基于Qt实现的轻量级CAD画图软件

基于Qt开发的轻量级CAD应用程序

weixin_44954230的博客 5659

Codeforces Round #292 (Div. 1)A. Drazil and Factorial 构造

A. Drazil and Factorial 题目连接: http://codeforces.com/contest/516/problem/A Description Drazil is playing a math game with Varda. Let's define for positive integer x as a product of factorials of its di...

weixin_34138521的博客 78

Lumerical官方案例、FDTD时域有限差分法仿真学习(十三)——多模干涉耦合器(MMI)

计算通过 1×2 端口多模干涉 (MMI) 耦合器的宽带传输和光损耗。 使用设备 S 参数在 INTERCONNECT 中创建 MMI 的紧凑模型。 它还展示了如何使用 CML 编译器提取这些参数以生成紧凑模型。 一、概述 了解模拟工作流程和关键结果 低损耗光合路器和分路器是基于 Mach-Zehnder 的光调制器的基本组件,并且是集成电路的关键组成部分。通过在输入/输出波导处使用线性锥形确保输入/输出波导的模式与干涉区域之间的

weixin_45719141的博客 1万+

Codeforces Round #292 (Div. 2), problem: (C) Drazil and Factorial 【水题? 阶乘乘积划分】

Codeforces Round #292 (Div. 2), problem: © Drazil and Factorial 题目大意 让一个n位数经过函数变换后,不会出现0和1 并且尽可能是最大值,然后瞒住F ( x ) = F ( a ) 题解 0 和 1 我们就不考虑了,然后根据阶乘乘积公式我们可以得到 F(4)= 3 ! * 2 ! * 2 ! F(6)=...

超逸の学习技术博客 1575

Fortran环境配置:VS2022+Intel oneAPI安装全流程指南

Fortran环境配置:VS2022+Intel oneAPI安装全流程指南

shuyisuisuinian的博客 2万+

RK3568—基于GM8775C的MIPI转双通道LVDS屏幕调试

Rockchip RK3568 原生显示接口不支持双通道LVDS屏幕的数据输出,因此需要借助显示转换芯片才能实现双通道LVDS屏幕的驱动。本文介绍使用GM8775C芯片方案,在 RK3568 平台实现单路 MIPI DSI 信号输出来驱动双通道LVDS显示屏。 关于GM8775C GM8775C 型 DSI 转双通道 LVDS 发送器产品主要实现将 MIPI DSI 转单/双通道 LVDS功能,MIPI 支持 1/2/3/4 通道可选,每通道最高支持 1Gbps 速率,最大支持 4Gbps 速率。LV.

Industio_优快云的博客 1万+

Codeforces Round #292 (Div. 2) -- 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

Never say never 1568

【SoloPi】SoloPi使用2-功能使用,录制回放

Soloπ是什么 Soloπ是一个无线化、非侵入式的Android自动化工具,公测版拥有录制回放、性能测试、一机多控三项主要功能,能为测试开发人员节省宝贵时间。 录制回放功能 Soloπ拥有录制操作的能力,用户只需要通过Soloπ执行用例步骤,Soloπ就能够将用户的操作记录下来,并且支持在各个设备上进行回放,这一切都能够在手机上独立完成。 ...

q_Catherine的博客 5829

Codeforces Round #292 (Div. 2) Problem 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

PE亦是WA 662

Qupath软件的安装与使用

Qupath软件的安装与使用软件安装软件下载软件安装【windows版】简单使用文件打开人工标注标注导出和导入 Qupath是一款开源的医学图像标注软件,适合放射影像及数字病理切片等的查看。同时,其自带的标注功能使得医生可以直接通过该软件进行病变区域的标注和分类。跟进一步的,该软件提供groovy脚本运行接口,可供操作者编写和运行脚本,将标注信息转换为xml或者json格式的数据进行进一步的后序处...

qq_40662074的博客 3万+

探索如何利用CST和ADS进行DDR的SIPI联合仿真

本文系统介绍了CST和ADS两款工具进行DDR信号完整性/电源完整性(SI/PI)联合仿真的方法。CST采用工作室协同方式,通过PCB布局导入、材料设置、模型分配等步骤,重点分析了电源阻抗优化和信号波形质量。ADS则利用SIPro、PIPro等专用工具,突出系统级验证和自动化优化功能。两者各有优势:CST擅长3D结构精确建模,ADS更适于快速系统验证。文章建议可根据项目需求混合使用两种工具,并提供了模型简化、频带选择等实用技巧。通过对比分析,为工程师选择仿真工具提供了决策参考。

一只豌豆象的博客 1150

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

Drazil is playing a math game with Varda. Let's definefor positive integerxas a product of factorials of its digits. For example,. First, they choose a decimal numberaconsisting ofnd...

dgjm4087的博客 176

5.13华为OD机试真题 新系统 - 社交网络相同爱好好友查询 (Java/Py/C/C++/Js/Go)

5.13华为OD机试真题 新系统 - 社交网络相同爱好好友查询 (Java/Py/C/C++/Js/Go)

算法大师! 155

Codeforces Round #292 Editorial-C. Drazil and Factorial

简单说一下题意:给定一个长度为n的数字a,找到一个数字x,使得x的各位阶乘之和等于a的各位阶乘之和 思路:读完题看了一下样例1,发现输出的一串数字是把原数字的4换成了322并降序排序 开始找规律 4->3 2 2 6->5 3 8->7 2 2 2 9->7 3 3 2 刚开始找的时候只找到了 4 6 8没找到9,后来发现9!...

qq_62984481的博客 216

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

精雕软件(JDpaint) 5.5 绿色版

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

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

题意:令F(i)为i的每一位数字阶乘积,例如F(931) = 9!*3!*1!给你一个a,找到最大的x满足F(x) = F(a),并且要求x中不能出现数字1和09! = 7!*3!*3!*2!8! = 7!*2!*2!*2!6! = 5!*3!4! = 3!*2!*2!#include&lt;stdio.h&gt; #include&lt;algorithm&gt; using namespace...

加载中... 345

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Codeforces Round #292 (Div. 2) C. Drazil and Factorial(贪心YY)

题目链接:http://codeforces.com/contest/515/problem/C 题意:定义了f(a)是正整数a中每一位数字的阶乘之和,求没有1,0数字且最大的b使得f(b)=f(a) 思路:可以用数组记录f(a)有哪些因数,而且让b最大,所以可以把非素数的因数分成素数因数,然后从高位到低位输出,有些细节还是要注意。 //Accepted 31 ms 4 KB #incl

kalilili的专栏 744

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

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

题目链接:http://codeforces.com/contest/515/problem/C 给出一个公式例如:F(135) = 1! * 3! * 5!; 现在给你一个有n位的数字a,让你求这样一个x,满足x中没有0和1,F(a) = F(x),然后就是x要最大. 当x的位数比a多或者从高位开始x的数某一位要大于a的某一位,然后第二种显然是不可能的,所以我们寻找如何把a变长的方法. ...

weixin_30547797的博客 143

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

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

传送门 Description Drazil is playing a math game with Varda. Let's definefor positive integerxas a product of factorials of its digits. For example,. First, they choose a decimal numberacons...

weixin_30491641的博客 105

Codeforces Round #177 (Div. 2)---D. Polo the Penguin and Houses (组合数学+暴力)

Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer pi (

Alex 2169

ZeptoLab Code Rush 2015---C. Om Nom and Candies

A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with

Alex 1959

Codeforces Round #291 (Div. 2)---D. R2D2 and Droid Army

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputAn army of n droids is lined up in one row. Each droid is described by m integers a1,

Alex 1302

Codeforces Round #305 (Div. 2)C---Mike and Frog(扩欧+乱搞)

Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.So,

Alex 1292

Codeforces Round #177 (Div. 2)---E. Polo the Penguin and XOR operation(贪心)

Little penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to n, inclusive.For permutation p = p0, p1, …, pn, Polo has defined its beauty — number .Expression mean

Alex 1275
上一篇: hdu2609---How many
下一篇: hdu4513---吉哥系列故事——完美队形II
tokers
博客等级 码龄12年 71粉丝 700原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值