Doki Doki Literature Club

ZOJ - 4035

题解:其实就是简单排序输出就没了。

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
struct node {
ll w;
char name[25];
}s[500];
bool cmp(struct node a, struct node b)
{
return a.w > b.w;
}
int main()
{
ll t,n,m,sum;
scanf("%lld",&t);
while(t--)
{
scanf("%lld %lld", &n,&m);
for(ll i = 1; i <= n; i ++)
{
getchar();
scanf("%s %lld", s[i].name, &s[i].w);
// cout << s[i].name << endl;
}
sort(s + 1, s + n + 1, cmp);
sum = 0;
for(ll i = 1; i <= m; i ++)
{
sum = sum + (s[i].w *(m - i + 1));
}
printf("%lld ",sum);
for(ll i = 1; i <= m; i ++)
{
if(i == 1)printf("%s",s[i].name);
else printf(" %s",s[i].name);
}
printf("\n");
}
return 0;
}

Doki Doki Literature Club ZOJ - 4035的更多相关文章

  1. The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - L Doki Doki Literature Club

    Doki Doki Literature Club Time Limit: 1 Second      Memory Limit: 65536 KB Doki Doki Literature Club ...

  2. Doki Doki Literature Club

    Doki Doki Literature Club! is a visual novel developed by Team Salvato. The protagonist is invited b ...

  3. The 15th Zhejiang Provincial Collegiate Programming Contest(部分题解)

    ZOJ 4024 Peak 题意 给出n和n个数,判断该数列是否是凸形的. 解题思路 从前往后第一对逆序数,和从后往前第一队逆序数,如果都非零而且相邻,证明该数组是凸形的. 代码 #include & ...

  4. 2018浙江省赛(ACM) The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

    我是铁牌选手 这次比赛非常得爆炸,可以说体验极差,是这辈子自己最脑残的事情之一. 天时,地利,人和一样没有,而且自己早早地就想好了甩锅的套路. 按理说不开K就不会这么惨了啊,而且自己也是毒,不知道段错 ...

  5. idea 插件推荐 & 代码样式安装

    部分链接打不开的可能需要梯子, 部分插件我懒得截图了,麻烦 ---------------------------------------header------------------------- ...

  6. FC红白机游戏列表(维基百科)

    1055个fc游戏列表 日文名 中文译名 英文版名 发行日期 发行商 ドンキーコング 大金刚 Donkey Kong 1983年7月15日 任天堂 ドンキーコングJR. 大金刚Jr. Donkey K ...

  7. 99种用Racket说I love you的方式

    99种用Racket说I love you的方式 来源 https://www.tuicool.com/articles/qiyeAz 原文  http://www.soimort.org/posts ...

  8. poj 2096 Collecting Bugs && ZOJ 3329 One Person Game && hdu 4035 Maze——期望DP

    poj 2096 题目:http://poj.org/problem?id=2096 f[ i ][ j ] 表示收集了 i 个 n 的那个. j 个 s 的那个的期望步数. #include< ...

  9. poj 2096 , zoj 3329 , hdu 4035 —— 期望DP

    题目:http://poj.org/problem?id=2096 题目好长...意思就是每次出现 x 和 y,问期望几次 x 集齐 n 种,y 集齐 s 种: 所以设 f[i][j] 表示已经有几种 ...

随机推荐

  1. Java坑人面试题之自动装箱和拆箱后的引用数据类型和基本数据类型的计算

    在Java1.5以后的版本中,引用类型Integer和基本数据类型int之间是可以通过自动装箱和拆箱进行计算的 例如: Integer in = 1; //it means  Integer in = ...

  2. 使用UTF8字符集存储中文生僻字

    使用UTF8字符集存储中文生僻字 一.相关学习BLOG https://www.cnblogs.com/jyzhao/p/8654412.html http://blog.itpub.net/7818 ...

  3. java基础知识学习 内存相关

    Java 内存分配策略 静态存储区(方法区):主要存放静态数据.全局 static 数据和常量.这块内存在程序编译时就已经分配好,并且在程序整个运行期间都存在. 栈区 :当方法被执行时,方法体内的局部 ...

  4. Linux查看进程并重启服务命令

    top -u root 查看系统进程service network restartservice iptables restartservice sshd restartservice nginx r ...

  5. centos源码安装nginx

    1.安装依赖 nginx对以下工具包有依赖,我们可以一键安装,命令: yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-dev ...

  6. nlopt 二次优化

    /* * main.c * * Created on: Oct 9, 2018 * Author: lgh */ #include <stdio.h> #include <math. ...

  7. optparser模块 与 ZIP爆破(Python)

    optparser模块: 为脚本传递命令参数. 初始化: 带 Usage 选项(-h 的显示内容 Usage:): >>> from optparse import OptionPa ...

  8. vs-code 的常用插件

    最近编辑器转移至VS-Code上面了,为什么抛弃sublime呢,因为,sublime在项目逐渐变大的过程中(项目已上万行,还在不停继续变大),sublime会出现卡顿,反应缓慢,甚至未响应状态,基于 ...

  9. Django路由及函数视图

    路由系统 在django中,uri与逻辑函数的对应关系我们称之为路由系统 伪静态 伪静态是相对于静态文件来说的,例如https://www.cnblogs.com/hesujian/p/1116581 ...

  10. Input system (输入子系统)

    Input system (输入子系统) 以前写一些输入设备(键盘,鼠标等)的驱动都是字符设备,混杂设备处理的,linux开源社区的大神门看到了这大量的输入设备如此分散不堪,就想有木有一种机制,可以对 ...