hdu-1261
来源:互联网 发布:茶叶网络推广 编辑:程序博客网 时间:2024/04/30 10:18
字符串,本来想的这道题很简单
#include<stdio.h>
#include<string.h>
int len,a[1000];
void jiecheng(int n)
{
int i,j,temp,carry;
a[0]=1;
len=1;
for(i=2;i<=n;i++)
{
carry=0;
for(j=0;j<len;j++)
{
temp=a[j]*i+carry;
a[j]=temp%10000;
carry=temp/10000;
}
if(carry)
a[len++]=carry;
}
}
int main()
{
int i,j,k,n,temp;
int sum,num[26],carry;
while(~scanf("%d",&n),n!=0)
{
sum=0;
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
sum+=num[i];
}
jiecheng(sum);
for(i=0;i<n;i++)
{
for(j=2;j<=num[i];j++)
{
carry=0;
for(k=len-1;k>=0;k--)
{
temp=a[k]+carry*10000;
a[k]=temp/j;
carry=temp%j;
}
if(a[len-1]==0) len--;
}
}
printf("%d",a[len-1]);
for(i=len-2;i>=0;i--)
printf("%04d",a[i]);
printf("\n");
}
return 0;
}
- hdu 1261
- hdu-1261
- HDU 1261
- hdu 1261 字串数
- HDU -1261 组合数学。
- hdu 1261(排列组合)
- hdu 1261 字串数
- HDU - 1261 字串数
- HDU-1261 字串数
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- 《编程珠玑(第2版)》笔记——将一个n元一维向量向左旋转i个位置(第2章)
- Android平台下驱动的开发及测试框架概述(二)
- toj 2857. Digit Sorting
- 基于SDL的SDL_mixer库的音乐播放器
- error: ‘for’ loop initial declarations are only allowed in
- hdu-1261
- JAVA编译过程
- 回复是对付对付对付多个发个
- POJ 3071 Football(简单 概率DP)
- c++11 Lambda函数与表示式
- spark 读取hadoop 格式的文件
- 拖动条SeekBar的简单使用
- 排序算法(Java)----基本算法
- Android4.2.2下Stagefright下OMX编解码器组件的控制流