/* HDU 6034 - Balala Power! [ 大数进位,贪心 ] 题意: 给一组字符串(小写英文字母),将上面的字符串考虑成26进制数,每个字母分配一个权值,问这组数字加起来的和最大是多少? 要求每个数字不能有前导0,即每个字符串首位字符不能赋0 分析: 对于每个字符,将每个字符串按位相加,得到这个字符的一个每位上的数量的数组 将其看成一个大数,满26进位,然后排序,从高到低赋值,注意考虑0 */ #include <bits/stdc++.h> using namespace…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2668    Accepted Submission(s): 562 Problem Description Sample Input 1 a 2 aa bb 3 a ba abc Sample Output Case #1: 25 Case #2: 132…
Talented Mr.Tang has nn strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each number ranged from 0 to 25, but each two different characters should not…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1411    Accepted Submission(s): 239 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters.…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3555    Accepted Submission(s): 844 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. H…
题目链接 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each number ranged from 0 to 25, but each two differen…
Balala Power![排序/进制思维] Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 6703    Accepted Submission(s): 1680 Problem Description Talented Mr.Tang has n strings consisting of only lower case cha…
题意:给定一个 n 个字符串,然后问你怎么给 a-z赋值0-25,使得给定的字符串看成26进制得到的和最大,并且不能出现前导0. 析:一个很恶心的题目,细节有点多,首先是思路,给定个字符一个权值,然后要注意的进位,然后排序,从大到小,给每个字符赋值,如果最后一个出现前导0,就得向前找一个最小的不在首字符的来交换,但不能动了相对的顺序. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <c…
题目大意:给出的字符串,每个字符建立一种与0-25的对应关系.然后每个字符串看成是一个26进制的数.问能获得的数的总和的最大值.(最后对1e9+7取模). 题目思考:把每个字符的贡献值看做一个26进制数字,贪心排序后,确保没有前导零.写的要规范点,卡时间. #include <stdio.h> #include <string.h> #include <vector> #include<math.h> #include <algorithm> #…
B - Balala Power! 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=6034 题面描述 Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each…
Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each number ranged from 0 to 25, but each two different cha…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 4124    Accepted Submission(s): 1004 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters.…
Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each number ranged from 0 to 25, but each two different characters should not b…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3757    Accepted Submission(s): 907 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. H…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3757    Accepted Submission(s): 907 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. H…
Balala Power! Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 714    Accepted Submission(s): 117 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. He…
2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛初始值是1500,变化了几次,得到的正确结果和bug后的是否相等.(Tourist大佬好 Y(^o^)Y) #include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { in…
本文首发于个人博客https://kezunlin.me/post/95370db7/,欢迎阅读最新内容! keras multi gpu training Guide multi_gpu_model import tensorflow as tf from keras.applications import Xception from keras.utils import multi_gpu_model import numpy as np G = 8 batch_size_per_gpu =…
[Link]:http://acm.hdu.edu.cn/showproblem.php?pid=6034 [Description] 给你n个字符串; 每个字符串都仅由小写字母组成; 然后,你可以把每个小写字母都映射成0..25中的任意一个数字; (两个不同的字母不能映射成相同数字); 组成的26进制数; 问这n个26进制数的最大和是多少; [Solution] 记录每个字母在哪一位上出现过多少次; ->其实就是记录每个字母在某些位权上的系数; 然后; 把占的位权总和最多的字母优先往前放就好;…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 Fighting the Landlords Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 312    Accepted Submission(s): 100 Problem Description Fighting the…
/* HDU 6168 - Numbers [ 思维 ] | 2017 ZJUT Multi-University Training 9 题意: .... 分析: 全放入multiset 从小到大,慢慢筛 */ #include <bits/stdc++.h> using namespace std; const int N = 125250; int n, s[N]; int a[N], cnt; multiset<int> st; multiset<int>::it…
/* HDU 6143 - Killer Names [ DP ] | 2017 Multi-University Training Contest 8 题意: m个字母组成两个长为n的序列,两序列中不能包含同一个字母,问对数 分析: 问题归结于: 包含i(1<=i<=m)个字母的长为n的序列的个数 则答案为 ans = sum of dp[n][i] * pow(m-i, n); 易得 dp[a][b] = b*dp[a-1][b] + C[m-b+1][1] * dp[a-1][b-1]…
看标程的代码这么短,看我的.... 难道是静态LCA模板太长了? /* HDU 6074 - Phone Call [ LCA,并查集 ] | 2017 Multi-University Training Contest 4 题意: 给一棵树,定义集合S(u,v)为u到v路径上所有的点 给出 m 个 <S(u1,v1)|S(u2,v2) , w > ,意思为集合里面的点互相距离为 w 求 1 能到的所有点和该生成树的最小权值 分析: 将所有线路按代价从小到大排序,对于每条线路(a,b,c,d)…
/* HDU 6068 - Classic Quotation [ KMP,DP ] | 2017 Multi-University Training Contest 4 题意: 给出两个字符串 S[N], T[M], k个询问 每个询问给出 L,R 对所有 1<=i<=L , r<=j<=N , S串拿掉[i+1,j-1]的子串后,剩下两个子串拼在一起的子串中 T 串的数目求和 限制 N,k <= 5e4, M <= 100 分析: pre[i] 代表 前缀i匹配的T…
/* HDU 6076 - Security Check [ DP,二分 ] | 2017 Multi-University Training Contest 4 题意: 给出两个检票序列 A[N], B[N] 规定 abs(A[i]-B[j]) <= k 的i,j不能同时检票 求最少的检票时间 限制 N<= 6e4, k <= 10 分析: f(i,j) 为检票至i,j的时间 则 f(i,j) = f(i-1,j-1) + 1 , abs(A[i]-B[j]) > k = min…
/* HDU 6071 - Lazy Running [ 建模,最短路 ] | 2017 Multi-University Training Contest 4 题意: 四个点的环,给定相邻两点距离,问从2号点出发,2号点结束,距离大于k的最短距离 d(i,j) < 30000, k <= 1e18 分析: 设 r = min(d(1,2), d(2,3)) 假设距离 k 可达,则 k+2*r 也可达(来回走的形式) 故求出所有 d[i][j] 满足 d[i][j]%2r == j 的最短距离…
/* HDU 6078 - Wavel Sequence [ DP ] | 2017 Multi-University Training Contest 4 题意: 给定 a[N], b[M] 要求满足 a[f(1)]<a[f(2)]>a[f(3)]<a[f(4)]>a[f(5)]<a[f(6)]... b[g(i)] == a[f(i)] f(i) < f(i+1), g(i) < g(i+1) 的子序列 的数目 分析: dp[i][j][0] 表示 以a[i]…
比赛时会错题意+不知道怎么线段树维护分数- - 思路来自题解 /* HDU 6070 - Dirt Ratio [ 二分,线段树 ] | 2017 Multi-University Training Contest 4 题意: 给出 a[N]; 设 size(l,r)为区间(l,r)不同数字的个数,求 size(l,r)/(r-l+1) 的最小值 限制: N <= 6e5, a[i] <= 6e5 分析: 二分答案 mid 则判定条件为是否存在 size(l,r)/(r-l+1) <=…
/* HDU 6036 - Division Game [ 组合数学,NTT ] | 2017 Multi-University Training Contest 1 题意: k堆石子围成一个圈,数量均为n,编号为0至k-1 第i轮可以操作第 (i+1) mod k 堆石子,必须拿石子且原石子数量要求整除操作后石子数量 任意一堆石子只剩一颗后停止游戏,问游戏停止在第i堆的方案数 限制: n很大,按唯一分解定理形式给出 n = p1^e1 * p2^e2 * ... * pm^em m,k <=…
建模简析: /* HDU 6039 - Gear Up [ 建模,线段树,图论 ] | 2017 Multi-University Training Contest 1 题意: 给你n个齿轮,有些齿轮是同轴的(角速度相同),有些是同边的(线速度相同),任意两个齿轮两种关系中至多只有一种,且任意两个齿轮之间只有一条路径 给出所有齿轮的半径和 m组两两之间的关系 两种操作:1. 把改变某个齿轮的半径; 2. 赋予某个齿轮一个角速度,问所有齿轮中最大的角速度是多少 分析: 相邻齿轮连边建图,原图是森林…