第一次写压位高精度只好抄黄学长的

  代码最后一段想了好久一看评论区才知道黄学长写错了= =很气

  自己最后改对了T^T

  这题最优是一直划分3出来直到<=4

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=,inf=1e9;
int n,l=,d[],ans[]={};
void mul(int x)
{
for(int i=;i<l;i++)ans[i]*=x;
for(int i=;i<l;i++)
{
ans[i+]+=ans[i]/;
ans[i]%=;
}
for(;ans[l];l++)ans[l+]+=ans[l]/,ans[l]%=;
}
int get(int x)
{
if(x>=)return ;
if(x>=)return ;
if(x>=)return ;
return ;
}
int main()
{
scanf("%d",&n);
for(;n>;n-=)mul();mul(n);
for(int i=;i<l;i++)d[i]=get(ans[i]);
printf("%d\n",(l-)*+d[l-]);
printf("%d",ans[l-]);
for(int i=l-;i>=max(,l-);i--)
{
for(int j=d[i]+;j<=;j++)putchar('');
printf("%d",ans[i]);
}
if(l->)
{
if(d[l-]==)printf("%d",ans[l-]/);
else if(d[l-]==)
{
if(ans[l-]<)putchar('');
printf("%d",ans[l-]/);
}
else if(d[l-]==)
{
if(ans[l-]<)putchar('');
if(ans[l-]<)putchar('');
printf("%d",ans[l-]/);
}
}
return ;
}

bzoj1263: [SCOI2006]整数划分(高精度+构造)的更多相关文章

  1. BZOJ1263 [SCOI2006]整数划分 高精度

    欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ1263 题意概括 将n写成若干个正整数之和,并且使这些正整数的乘积最大. 例如,n=13,则当n表示 ...

  2. BZOJ 1263: [SCOI2006]整数划分( 高精度 )

    yy一下发现好像越小越好...分解成3*3*3*3……这种形式是最好的...然后就是高精度了 ----------------------------------------------------- ...

  3. BZOJ1263: [SCOI2006]整数划分

    1263: [SCOI2006]整数划分 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 677  Solved: 332[Submit][Status] ...

  4. 【bzoj1263】[SCOI2006]整数划分 高精度

    题目描述 从文件中读入一个正整数n(10≤n≤31000).要求将n写成若干个正整数之和,并且使这些正整数的乘积最大. 例如,n=13,则当n表示为4+3+3+3(或2+2+3+3+3)时,乘积=10 ...

  5. [BZOJ1263][SCOI2006]整数划分(数学+高精度)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1263 分析:数学老师上课讲过啦= =,就是尽可能3越多越好.然后就写个高精度就行了.

  6. bzoj 1263 [SCOI2006]整数划分

    n >= 6 的时候减3, 最后分类讨论, 上个Java import java.math.BigInteger; import java.util.*; public class Main { ...

  7. 大概是:整数划分||DP||母函数||递推

    整数划分问题 整数划分是一个经典的问题. Input 每组输入是两个整数n和k.(1 <= n <= 50, 1 <= k <= n) Output 对于每组输入,请输出六行. ...

  8. hdu 1028 & hdu 1398 —— 整数划分(生成函数)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1028 整数划分,每个数可以用无限次: 所以构造 f(x) = (1+x+x2+x3+...)(1+x2+x ...

  9. 51nod p1201 整数划分

    1201 整数划分 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 将N分为若干个不同整数的和,有多少种不同的划分方式,例如:n = 6,{6} {1,5} {2, ...

随机推荐

  1. hdu1203I NEED A OFFER!(01背包)

    I NEED A OFFER! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  2. 文件包含漏洞(RFI)

    1文件包含漏洞简介 include  require  include_once   require_once RFI综述 RFI是Remote File Inclusion的英文缩写,直译过来就是远 ...

  3. [CodeForce431C]k-tree

    Quite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired ...

  4. Django学习总结- ③

    对象属性与继承关系: 对象属性 1. 显示属性 - 开发者手动定义的,直接看的到的 2. 隐式属性 - 系统根据需求,自动创建的对象 - objects 它是model.Manager对象 - 当我们 ...

  5. 正则表达式 和 re 模块

    正则表达式究竟是什么? 在一些网站注册的时候需要输入手机号码,当你输入一个错误的手机号码的时候,会提示你输入的手机号码格式错误 那么他究竟是如何判断的呢? 我们用Python代码进行表示: phone ...

  6. Python3 Tkinter-Radionbutton

    1.创建单选按钮 from tkinter import * root=Tk() Radiobutton(root,text='b1').pack() Radiobutton(root,text='b ...

  7. SPOJ 694 Distinct Substrings/SPOJ 705 New Distinct Substrings(后缀数组)

    Given a string, we need to find the total number of its distinct substrings. Input T- number of test ...

  8. ZOJ 3689 Digging(DP)

    Description When it comes to the Maya Civilization, we can quickly remind of a term called the end o ...

  9. VUE中关于表单提交的简单实现

    main.js import Vue from "../vue.js"; import App from "./App.js"; //启动 new Vue({ ...

  10. 关于localStorage的实际应用

    在客户端存储数据 HTML5 提供了两种在客户端存储数据的新方法: localStorage - 没有时间限制的数据存储 sessionStorage - 针对一个 session 的数据存储 之前, ...