读懂题意就是水题,按照出现次数对下标排一下序,暴力。。

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll; const int maxn = 1e4+;
ll cnt[maxn];
ll r[maxn];
bool cmp(int a,int b) { return cnt[a] > cnt[b]; } int main()
{
int T;
scanf("%d",&T);
for(int k = ; k <= T; k++){
int M,N,C;
scanf("%d%d%d",&M,&N,&C);
memset(cnt,,sizeof(cnt));
for(int i = ; i < M; i++){
int tmp;
scanf("%d",&tmp);
cnt[tmp]++;
}
for(int i = ; i < N; i++) { r[i] = i+; }
sort(r,r+N,cmp);
ll amus = (r[]*r[])%C;
ll best = cnt[r[]]*amus;
for(int i = ; i < N; i++) {
amus += (r[i]*r[i])%C;
ll tmp = cnt[r[i]]*amus;
best = max(best,tmp);
}
printf("Case %d: %I64d\n",k,best);
}
return ;
}

codeforce Gym 100500C ICPC Giveaways(水)的更多相关文章

  1. codeforce Gym 100500H ICPC Quest (简单dp)

    题意:给一个nXm的矩阵,上面有一些数字,从左上角出发,每次只能往右或者往下,把沿途的数字加起来,求到达右下角的最大值是多少. 题解:简单的一个dp,设f[i][j]为到达i行j列的最大值,f[i][ ...

  2. codeforces Gym 100500C C. ICPC Giveaways 排序

    Problem C. ICPC GiveawaysTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1005 ...

  3. codeforces Gym 100500H H. ICPC Quest 水题

    Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...

  4. codeforce Gym 100500I Hall of Fame (水)

    题意:统计一些串中,字母的出现频率,不分大小写,找出现频率最高5个字符(相同频率优先取字典序大的),把他们的对应的值加起来判断以下是否大于62. 没出现的不算. #include<cstdio& ...

  5. Codeforces gym 100685 C. Cinderella 水题

    C. CinderellaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/C ...

  6. Codeforce Gym 100015I Identity Checker 暴力

    Identity Checker 题目连接: http://codeforces.com/gym/100015/attachments Description You likely have seen ...

  7. codeforces Gym 100500C D.Hall of Fame 排序

    Hall of Fame Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachmen ...

  8. Codeforces GYM 100114 B. Island 水题

    B. Island Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description O ...

  9. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

随机推荐

  1. 多版本Shader与multi_compile

    多版本Shader与multi_compile   https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html   #pragma ...

  2. css清除浮动的方法总结

    在各种浏览器中显示效果也有可能不相同,这样让清除浮动更难了,下面总结8种清除浮动的方法,测试已通过 ie chrome firefox opera,需要的朋友可以参考下     清除浮动是每一个 we ...

  3. git 的基本设置以及使用

    https://www.linuxidc.com/Linux/2018-05/152611.htm 详解git add , git commit , git push, 等命令 https://blo ...

  4. day7计算作业详解

    1.day7题目 1.判断一个数是否是水仙花数, 水仙花数是一个三位数, 三位数的每一位的三次方的和还等于这个数. 那这个数就是一个水仙花数, 例如: 153 = 13 + 53 + 3**3 2.给 ...

  5. 微信站 - 实现复制功能 clipboard

    <script src="https://cdn.bootcss.com/clipboard.js/1.5.9/clipboard.js"></script> ...

  6. 安卓下点击a标签不跳转;点击a标签在手机真机上会调出手机键盘的解决办法

    安卓下点击a标签不跳转的解决办法,是不用href做跳转的链接,改为用JS控制跳转 <a href="javascript:;" ontouchstart="wind ...

  7. easyui的datagrid用js插入数据等编辑功能的实现

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. 牛客假日团队赛2 F.跳跃

    链接: https://ac.nowcoder.com/acm/contest/924/F 题意: Farmer John为了满足奶牛对美的享受而安装了人工湖.矩形的人工湖分成M行N列(1 <= ...

  9. jq:静态页面常会用到的jq操作(记录)

    1 在php的mvc模式中通常需要做数据异步处理,其中也包含了对htm页面的操作,下面是近期长用到的jq操作,后续会继续补充 2 3 1:修改input框的value值 4 <input typ ...

  10. Jmeter4.0----设置集合点_并发(11)

    1.说明 LR中集合点可以设置多个虚拟用户等待到一个点,同时触发一个事务,以达到模拟真实环境下多个用户同时操作,实现性能测试的最终目的. jmeter中使用Synchronizing Timer实现L ...