# include <queue>
# include <cstdio>
# include <cstring>
# include <iostream>
# include <algorithm>
using namespace std; int v[4] = {1,10,100,1000},a[100000]; struct BigNumber{
int d[1000];
BigNumber() { memset(d,0,sizeof(d)); d[0] = 1; }
BigNumber operator =(const int b){
char s[40];
sprintf(s,"%d",b);
int len = strlen(s);
memset(d,0,sizeof(d));
d[0] = (len - 1)/4 + 1;
for(int i = 0;i < len;i++) d[(len-i-1)/4+1] += (s[i]-'0')*v[(len-i-1)%4];
return *this;
}
void put(){
printf("%d",d[d[0]]);
for(int i = d[0]-1;i >= 1;i--) printf("%04d",d[i]);
printf("\n");
}
}; BigNumber operator * (const BigNumber &a,const int &k)
{
BigNumber c;
c.d[0] = a.d[0];
int i ,x = 0;
for(int i = 1;i <=a.d[0];i++){
x = a.d[i]*k + x;
c.d[i] = x%10000;
x /= 10000;
}
while(x > 0){
c.d[++c.d[0]] = x%10000;
x /= 10000;
}
while((c.d[0]>1) && (c.d[c.d[0]] == 0)) --c.d[0];
return c;
} int main()
{
//freopen("a.txt","r",stdin);
//freopen("b.txt","r",stdin);
__int64 n,i;
while(~scanf("%I64d",&n)){
BigNumber ans;
ans = 1;
if(n <= 4){
printf("%d\n",n); continue;
}
//算出n的连续和;
for(i = 2;i < n;i++){
a[i-2] = i;
n -= i;
} int cnt = i - 3;
while(n){
a[cnt]++;
n--;
cnt -= 1;
if(cnt == -1) cnt = i - 3;
}
for(int j = 0;j <= i - 3;j++){
//printf("%d ",a[j]);
ans = ans * a[j];
}
ans.put();
}
return 0;
}

HUNNU-10307-最优分解问题的更多相关文章

  1. gdufs 1237 最优分解问题

    题目链接:http://cstfs.gdufs.edu.cn:8080/JudgeOnline/problem.jsp?id=1237 (好像是内网的0.0) 简单来说,这道题目就是把一个数分解为若干 ...

  2. 【u225】最优分解方案

    Time Limit: 1 second Memory Limit: 128 MB [问题描述] 经过第一轮的游戏,不少同学将会获得圣诞特别礼物,但这时细心的数学课代表发现了一个问题: 留下来的人太多 ...

  3. AC日记——C’s problem(c) TYVJ P4746 (清北学堂2017冬令营入学测试第三题)

    P4746 C’s problem(c)   时间: 1000ms / 空间: 655360KiB / Java类名: Main 背景 冬令营入学测试 描述 题目描述 小C是一名数学家,由于它自制力比 ...

  4. [原]POJ1141 Brackets Sequence (dp动态规划,递归)

    本文出自:http://blog.csdn.net/svitter 原题:http://poj.org/problem?id=1141 题意:输出添加括号最少,并且使其匹配的串. 题解: dp [ i ...

  5. [原]NYOJ 括号匹配系列2,5

    本文出自:http://blog.csdn.net/svitter 括号匹配一:http://acm.nyist.net/JudgeOnline/problem.php?pid=2 括号匹配二:htt ...

  6. BZOJ1263: [SCOI2006]整数划分

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

  7. Sparse Principal Component Analysis via Regularized Low Rank Matrix Approximation(Adjusted Variance)

    目录 前言 文章概述 固定\(\widetilde{\mathrm{v}}\) 固定\(\widetilde{\mathrm{u}}\) Adjusted Variance 前言 这篇文章用的也是交替 ...

  8. Reinforcement Learning for Self Organization and Power Control of Two-Tier Heterogeneous Networks

    R. Amiri, M. A. Almasi, J. G. Andrews and H. Mehrpouyan, "Reinforcement Learning for Self Organ ...

  9. 化繁为简——分解复杂的SQL语句

    今天同事咨询一个SQL语句,如下所示,SQL语句本身并不复杂,但是执行效率非常糟糕,糟糕到一塌糊涂(执行计划也是相当复杂).如果查询条件中没有NOT EXISTS部分,倒是不要一秒就能查询出来. SE ...

随机推荐

  1. CentOS7 开启免密登陆

    1.开启免密登陆功能 以下文件 /etc/ssh/sshd_config 取消以下两项注释,如果没有添加. RSAAuthentication yes PubkeyAuthentication yes ...

  2. python linux安装anaconda

    步骤: 1.在清华大学镜像站中下载anaconda版本:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ https://mirrors.t ...

  3. gitlab简介配置和参数修改

    一.Gitlab基本简介 GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,可通过Web界面进行访问公开的或者私人项目,非常适合在团队内部使用. 在gitlab中有三个版本, ...

  4. Ubuntu Flask安装与配置(待整理)

    工作中开发需要用到python的flask框架,无奈网络上的资源很少,连基本的安装和配置都不全,在这做一下整理,方便以后用到. ———————————————————————————— 由于比较繁琐, ...

  5. NIO Channel的学习笔记总结

    摘自:http://blog.csdn.net/tsyj810883979/article/details/6876603 1.1  非阻塞模式 Java  NIO非堵塞应用通常适用用在I/O读写等方 ...

  6. 【leetcode dp】629. K Inverse Pairs Array

    https://leetcode.com/problems/k-inverse-pairs-array/description/ [题意] 给定n和k,求正好有k个逆序对的长度为n的序列有多少个,0& ...

  7. 【loj6191】「美团 CodeM 复赛」配对游戏

    题目 显然期望dp. 简单想法: f[i][j]表示前i个人中向右看并且没有被消除的人数的概率 如果第i+1个人是向右,$f[i+1][j+1]=f[i][j]/2$ 如果第i+1个人是向左,$f[i ...

  8. 【noip】noip201503求和(题解可能不完美,但绝对详细)

    3. 求和 难度级别:B: 运行时间限制:1000ms: 运行空间限制:51200KB: 代码长度限制:2000000B 题目描述   一条狭长的纸带被均匀划分出了n个格子,格子编号从1到n.每个格子 ...

  9. 等价表达式(codevs 1107 答案错误)

    题目描述 Description 明明进了中学之后,学到了代数表达式.有一天,他碰到一个很麻烦的选择题.这个题目的题干中首先给出了一个代数表达式,然后列出了若干选项,每个选项也是一个代数表达式,题目的 ...

  10. msp430项目编程41

    msp430综合项目---红外遥控直流电机调速系统41