SRM 599 D1L1:BigFatInteger,math
来源:互联网 发布:电视棒在淘宝上搜不到 编辑:程序博客网 时间:2024/04/30 02:55
题目:http://community.topcoder.com/stat?c=problem_statement&pm=12867&rd=15711
代码:
#include <algorithm>#include <functional>#include <numeric>#include <utility>#include <iostream>#include <sstream>#include <iomanip>#include <bitset>#include <string>#include <vector>#include <stack>#include <deque>#include <queue>#include <set>#include <map>#include <cstdio>#include <cstdlib>#include <cctype>#include <cmath>#include <cstring>#include <ctime>#include <climits>using namespace std;#define CHECKTIME() printf("%.2lf\n", (double)clock() / CLOCKS_PER_SEC)/*************** Program Begin **********************/class BigFatInteger {public:map < long long, long long > extractPrimeFactors(int x){map <long long, long long> ap;for (int p = 2; p * p <= x; p++) {int ex = 0;bool flag = false;while (x % p == 0) {flag = true;++ex;x /= p;}if (flag) {ap[p] = ex;}}if (x != 1) {ap[x] = 1;}return ap;}int minOperations(int A, int B) {int res = 0;auto ap = extractPrimeFactors(A);res = ap.size();int mxex = 0;for (auto it = ap.begin(); it != ap.end(); it++) {if (mxex < (*it).second) {mxex = (*it).second;}}for (int i = 1; i < mxex * B; i *= 2) {++res;}return res;}};/************** Program End ************************/
0 0
- SRM 599 D1L1:BigFatInteger,math
- SRM 602 D1L1:TypoCoderDiv1,dp
- SRM 622 D1L1: BuildingRoutes,shortest path
- SRM 626 D1L1: FixedDiceGameDiv1,贝叶斯公式,dp
- SRM 599 D2L2:BigFatInteger2, math
- SRM 436 DigitsSwap (math)
- SRM 617 D2L3: MyVeryLongCake, Math
- SRM 621 D2L3: MixingColors, math
- SRM 596 D2 L3:SparseFactorialDiv2,math
- SRM 572 D2L3:DistinctRemainders,dp,math
- SRM 622 D2L3: Subsets, math, backtrack
- SRM 628 D1L3:DoraemonPuzzleGame,math,期望,dp
- SRM 599 DIV2 950
- srm
- SRM 599 div2 250 500
- SRM 599 D2L3: SimilarNames2,dp
- SRM 586 Div II Level Three: StringWeightDiv2,Dynamic Programming or Math
- SRM 599 1A 2013.12.6
- elance 兼职手册
- 代码究竟能写多长
- 通过jstat、jmap对java程序进行性能调优
- android,内容提供者,短信发送
- 半质数
- SRM 599 D1L1:BigFatInteger,math
- Python 2.7.4的mimetypes.py bug修复
- C++类型转换关键字(*_cast)
- iOS- iOS 和 Android 的后台推送原理各是什么?有什么区别?
- 我的《鸟哥的Linux私房菜》笔记(一)初窥
- 1010 Radix (25)
- Windows7下查看CRUX 3.0虚拟机里面的linux ext2和ext3文件系统教程
- 我的《鸟哥的Linux私房菜》笔记(二)Linux的档案权限与目录配置
- Oracle Physical DataGuard使用RMAN增量备份修复GAP