Codeforces Round #292 (Div. 2) C. Drazil and Factorial 515C
2 seconds
256 megabytes
standard input
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.
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 a maximum possible integer satisfying the conditions above. There should be no zeroes and ones in this number decimal representation.
4
1234
33222
3
555
555
In the first case, 
题意 给出数x,得出x各位数阶乘的乘积;求得出的各位数乘积和与x得出的各位数阶乘的乘积相等的最大数
先打表ch[i] F[i]=F[p]最大值p,排序,反转
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
int n;
scanf("%d",&n);
string str;
cin>>str;
string str1 = "";
string ch[]={"","","","","","","","","",""};
for(int i = ; i < n; i++){
str1 += ch[str[i]-''];
}
sort(str1.begin(),str1.end());
reverse(str1.begin(),str1.end());
cout<<str1<<endl;
return ;
}
Codeforces Round #292 (Div. 2) C. Drazil and Factorial 515C的更多相关文章
- Codeforces Round #292 (Div. 2) C. Drazil and Factorial
		
题目链接:http://codeforces.com/contest/515/problem/C 给出一个公式例如:F(135) = 1! * 3! * 5!; 现在给你一个有n位的数字a,让你求这样 ...
 - Codeforces Round #292 (Div. 1) C. Drazil and Park 线段树
		
C. Drazil and Park 题目连接: http://codeforces.com/contest/516/problem/C Description Drazil is a monkey. ...
 - Codeforces Round #292 (Div. 1) B. Drazil and Tiles 拓扑排序
		
B. Drazil and Tiles 题目连接: http://codeforces.com/contest/516/problem/B Description Drazil created a f ...
 - Codeforces Round #292 (Div. 1) B. Drazil and Tiles (类似拓扑)
		
题目链接:http://codeforces.com/problemset/problem/516/B 一个n*m的方格,'*'不能填.给你很多个1*2的尖括号,问你是否能用唯一填法填满方格. 类似t ...
 - Codeforces Round #292 (Div. 1) - B. Drazil and Tiles
		
B. Drazil and Tiles Drazil created a following problem about putting 1 × 2 tiles into an n × m gri ...
 - Codeforces Round #292 (Div. 1) C - Drazil and Park
		
C - Drazil and Park 每个点有两个值Li 和 Bi,求Li + Rj (i < j) 的最大值,这个可以用线段树巧妙的维护.. #include<bits/stdc++. ...
 - Codeforces Round #292 (Div. 2) D. Drazil and Tiles [拓扑排序 dfs]
		
传送门 D. Drazil and Tiles time limit per test 2 seconds memory limit per test 256 megabytes Drazil cre ...
 - Codeforces Round #292 (Div. 1)A. Drazil and Factorial 构造
		
A. Drazil and Factorial 题目连接: http://codeforces.com/contest/516/problem/A Description Drazil is play ...
 - Codeforces Round #292 (Div. 2)
		
A. Drazil and Date 无算法,判断(s - (a + b)) % 2是否为零,若零,表示在s步内还能走向其他的地方并且回来 否则,都是No #include <cstdio> ...
 
随机推荐
- Sass入门指南
			
转自:http://www.imooc.com/article/1413 css预处理器已经算不上一个新鲜的词了,当前比较有代表性的css预处理器有sass.less.stylus.关于三者选择问题一 ...
 - day20-双下new方法,单例模式
			
# 1. __new__:构造方法,它创造对象,程序员口头语:new一个对象.先执行__new__方法再执行___init__方法. class Goods: def __init__(self):# ...
 - 006.前端开发知识,前端基础CSS(2020-01-21)
			
来源:第五天 01盒子水平居中 一.盒子中文字控制: 1.text-align: center; /*可以让盒子内容(文字 行内元素 行内块元素)居中对齐*/ 二.让盒子水平居中对齐: 方法1.ma ...
 - 《C程序设计语言》练习 1-8,1-9
			
#include <stdio.h> /*编写一个统计空格,制表符与换行符个数的程序*/ main() { int a,b,c,d;//a表示空格个数,b表示制表符个数,c表示换行符个数 ...
 - Windows可以往外ping,外部却ping不通本机
			
网络背景:192.168.1.17.192.168.1.19.192.168.1.20 三台机器都在一个exsi宿主机下网络非常简单 问题描述:17和19都可以ping通20:20却不能ping通17 ...
 - SpringBoot常见面试题
			
什么是SpringBootSpringBoot的作用SpringBoot的优点SpringBoot的核心配置文件是什么,有何区别?SpringBoot的配置文件有几种格式,区别是什么?SpringBo ...
 - ESTScan|EORF|Augustus|nr|PSM|
			
生物信息学方法的目的有二:1.常规找鉴定已知蛋白2.鉴定新蛋白 控制数据库大小可以通过增多酶切使得大数据库灵敏性增高数据量变小: 分步搜索是对于经典方法使用后找不到的新蛋白进行补充挖掘,预测蛋白与高可 ...
 - Angular开发者指南(六)作用域
			
什么是作用域? 作用域是引用应用程序模型的对象. 它是表达式的执行上下文. 作用域以层次结构排列,模仿应用程序的DOM结构,它可以观察表达式和传播事件. 作用域的特征 Scope提供API($watc ...
 - android翻译应用、地图轨迹、视频广告、React Native知乎日报、网络请求框架等源码
			
Android精选源码 android实现高德地图轨迹效果源码 使用React Native(Android和iOS)实现的 知乎日报效果源码 一款整合百度翻译api跟有道翻译api的翻译君 RxEa ...
 - TB3_Autorace之交通杆检测
			
利用blob检测算法识别交通杆,控制TB3机器人完成对交通杆的起停动作! 上一篇博文中<TB3_Autorace之路标检测>订阅了原始图像信息,经过SIFT检测识别出道路交通标志,这里我们 ...