首页 > 其他分享 >Add Again UVA - 11076

Add Again UVA - 11076

时间:2023-04-17 21:14:17浏览次数:44  
标签:Again cnt int 11076 Add include

 

define S ,it is sum of all possible permutations
of a given set of digits. For example, if the digits are <1 2 3>, then six possible permutations are
<123>, <132>, <213>, <231>, <312>, <321> and the sum of them is 1332.

 

 

#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
#define int unsigned long long
 int n,S,a[50],cnt[50] ;
 const int R[] = {0,1,11,111,1111,11111,111111,
 1111111,11111111,111111111,1111111111,11111111111,111111111111};
 
 int F(int x){
 	if(x==0) return 1;
 	int r=1;
 	for(int i=2;i<=x;i++) r*=i;
 	return r;
 }
 signed main(){
 	int i;
 	while(cin>>n && n){
 		memset(cnt,0,sizeof cnt) ;
 		int ans=S=0; 
 		for(i=1;i<=n;i++){
 			cin>>a[i]; ++cnt[a[i]]; S+=a[i];
 		}
 		int k=F(n) ;
 		for(i=0;i<=9;i++) k/= F(cnt[i]);
 		
 		cout<<(k*S*R[n])/n<<endl;
 	}
 }
 
 
 

 

标签:Again,cnt,int,11076,Add,include
From: https://www.cnblogs.com/towboa/p/17327523.html

相关文章

  • access violation at address isflash.dll
    右击“我的电脑”。单击“属性”。 在“系统属性”中单击“高级”。 在“性能”中单击“设置”。 在“性能选项”中单击“数据执行保护”。 单击“添加”。选择要运行的程序。 OK。就这么简单。 ......
  • log4j的additivity和category使用
    1log4j.rootCategory是对根类的设置,如不说明,以下的子类都要继承这些设置 log4j.category.*是对自定义类的设置,可以对类、包和工程单独设置Category的家族关系是通过“.”来说明的,比如x是x.y的父类。默认情况下,子类要继承父类的全部设置,比如:log4j.rootCategory=INFO,dest1log4j.ca......
  • Again Prime? No Time. UVA - 10780
    给定m,n,求最大的k使得m^k∣n! 分解质因数   #include<iostream>#include<cstring>#include<sstream>usingnamespacestd;constintN=1e4+20;constintinf=1e9;intn,m,a[N],b[N];intprime[N],tot,vis[N];voidinit(inttop){ for(......
  • How to use Linux shell command filter the IP address All In One
    HowtouseLinuxshellcommandfiltertheIPaddressAllInOne如何使用Linuxshell命令过滤IP地址questionHowtofilteroutthereallyusefulIPaddressfromlongstrings?如何从长字符串中过滤出真正有用的IP地址?$cat./dd-ip-notice-robot.sh$./dd......
  • Linux groupadd 命令
    Linuxgroupadd命令groupadd命令用于创建一个新的工作组,新工作组的信息将被添加到系统文件中。相关文件:/etc/group组账户信息。/etc/gshadow安全组账户信息。/etc/login.defsShadow密码套件配置。语法groupadd命令语法格式如下:groupadd[-ggid[-o]][-r][-f]......
  • Linux useradd 命令
    Linuxuseradd命令快速使用常用命令说明备注useradd-dtest添加用户并在home下创建默认目录,和adduser不同在于需要通过passwd设置密码,本身没有密码默认无密码账号保存在/etc/passwd简介Linuxuseradd命令用于建立用户帐号。useradd可用来建立用户......
  • 08 Shading(Shadding, Pipeline and Texture Mapping)
    关键点Real-TimeRenderingPipelineShader1.Graphics(Real-timeRendering)Pipeline管线1.1PipelineMVP,Rasterization,Z-Buffer,Shading,Texture1.2ShaderPrograms着色器通用程序,用于定义任意像素如何操作。来源[1]Games101.闫令琪......
  • 时序建模算法库PaddleTS技术与实践1
            ......
  • Maven_How To Add Oracle JDBC Driver In Your Maven Local Repository
    via: http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/ DuetoOraclelicenserestriction,thereisNOpublicMavenrepositoryprovidesOracleJDBCdriver.TouseOraclejdbcdrivewithMaven,youhavetoinstallit......
  • 完善SQL二进制到IP地址字符串转换(Perfecting SQL binary to IP Address string conve
    我们使用二进制(16)字段来存储IP地址。我们这样做,因为它可以同时拥有IPv4和IPv6地址,并且很容易与.NetIPAddress类一起使用。但是,为了报告目的,我创建了以下SQL函数将二进制地址转换为IP地址字符串。CREATEFUNCTIONfn_ConvertBinaryIPAddressToString(@binaryIPbinary(......