题目链接: 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. Let's define  for positive integer x as a product of factorials of i…
题意:给出含有 n 个只有阿拉伯数字的字符串a,设定函数F(a) = 每个数字的阶乘乘积 .需要找出 x,使得F(x) = F(a),且组成 x 的数字中没有0和1.求最大的 x 为多少. 析:最大,那么首先是位数最多,然后是前面尽量大,所以我们要让位数最大,那么就转化,2-2, 3-3, 4-322, 5-5, 6-53, 7-7, 8-7222, 9-733. 然后排序就好了. 代码如下: #pragma comment(linker, "/STACK:1024000000,10240000…
[题目链接]:http://codeforces.com/contest/515/problem/C [题意] 定义f(n)=n这个数各个位置上的数的阶乘的乘积; 给你a; 让你另外求一个不含0和1的最大的数字b; 使得f(a)==f(b) [题解] 对a的每一个大于1的数字进行分解; 看看它能够组合成的最多的比它小的数字的阶乘的乘积是哪些; 比如 4!=3!∗(2!)2 每个都找最多数目的:数目相同找大的数的组合; 求出2..9!的组合就好; 最后根据每个数字的分解方案; 求出所有的数字; 然…
[codeforces 516]A. 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 digits that con…
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes. Note that you should find only the time after a minutes, see the examples t…
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is wr…
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/problem/A Description Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x tha…
A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received a young builder's kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other…
题目链接: A. Vanya and Fence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In orde…
题意:给定 n 条边,判断是不是树. 析:水题,判断是不是树,首先是有没有环,这个可以用并查集来判断,然后就是边数等于顶点数减1. 代码如下: #include <bits/stdc++.h> using namespace std; const int maxn =1000 + 5; int p[maxn]; int Find(int x){ return x == p[x] ? x : p[x] = Find(p[x]); } int main(){ int n, m, x, y; cin…