栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 3681 E

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 3681 E

#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <vector>#include <bitset>#include <algorithm>using namespace std;#define rep(i,a,b) for(int i = a; i < b; ++i)typedef long long ll;const int N = 1000000;const int MOD = 1000000007;int n,m;vector<int> fac;void get_fac(int v) { fac.clear(); for(int i = 1; i*i <= v; ++i) { if(v % i == 0) { fac.push_back(i); if(v != i*i) fac.push_back(v/i); } } sort(fac.begin(), fac.end());}ll dp[N];int DP() { rep(i,0,(int)fac.size()) dp[i] = -1; int len = fac.size(); for(int i = 0; i < len; ++i) { dp[i] = fac[i]/2 + 1; int v = fac[i]; for(int j = 0; j < len && fac[j]<= v; ++j) { if(v % fac[j] == 0) { int x = v/fac[j]; ll tmp_value = (x/2 + 1)*dp[j]; dp[i] = min(dp[i], tmp_value); } } } return dp[len-1];}int main() { while(cin >> n >> m) { get_fac(n); int ans = DP(); if(m >= ans) puts("Yes"); else puts("No"); printf("%dn", ans); }}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/378141.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号