HDU 5702 Solving Order

AI权益加码!Claude Code、Cursor等20+工具免费用! 购周边限时加赠Coding Plan Lite,畅享主流AI工具!学习进阶更高效! 阅读详情

写个结构体,按数量排序,输出对应颜色。

开始怕有重复来着,觉得先不考虑那种情况,结果过了。

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<iomanip>
#include<stdlib.h>
#include<ctype.h>
#include<algorithm>
#include<deque>
#include<functional>
#include<iterator>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#define CPY(A, B) memcpy(A, B, sizeof(A))
typedef long long LL;
typedef unsigned long long uLL;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double OO = 1e20;
const double PI = acos (-1.0);
int dx[]= {0,1,1,1,0,-1,-1,-1};
int dy[]= {1,1,0,-1,-1,-1,0,1};
int gcd (const LL &a, const LL &b) {return b==0?a:gcd (b,a%b);}
using namespace std;
struct BB {
    string col; int num;
} b[110];
int cmp (BB a,BB b) {
    return a.num>b.num;
}
int main() {
    int T; scanf ("%d",&T);
    while (T--) {
        int n; scanf ("%d",&n);
        for (int i=0; i<n; ++i) {
            cin>>b[i].col;
            scanf ("%d",&b[i].num);
        }
        sort (b,b+n,cmp);
        for (int i=0; i<n; i++) {
            if (i) { cout<<" "<<b[i].col; }
            else { cout<<b[i].col; }
        }
        puts ("");
    }
    return 0;
}

2016女生赛 1001 Solving Order Solving Order Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Welcome to HDU to 阅读详情

相关推荐

HDU 5702 Coprime (莫比乌斯反演+反向思维)*

Coprime Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 3135    Accepted Submission(s): 1220   Problem Description There are n people stan...

满月照亮的路 1196

HDU 5702

题意: 给一些字符串,在每个字符串后面跟着一个数,每个数都不相同,根据数的大小将字符串进行排序。 输入: 3 3 red 1 green 2 yellow 3 1 blue 83 2 red 2 white 1 输出: yellow green red blue red white 分析: 结构体,能保留其中一个元素的ID

shao1996的博客 618

HDU 5702(Solving Order)排序

题目链接:https://vjudge.net/problem/HDU-5702题意:给出n种气球,输入它们的颜色和个数,按照个数从大到小的顺序输出气球的颜色。直接排序输出就行。#include&lt;bits/stdc++.h&gt; #define maxn 1000010 using namespace std; pair&lt;string,int&gt;mp; bool cmp(pair...

Eknight123的博客 495

Hdu-5702-Solving Order [排序]

题目传送门题意:输入n,并输入n行,每行一个颜色以及个数。 按个数从多到少输出颜色。 思路:结构体排序。#include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath>using namespace std;typedef struct

裤头是叫裤头的裤头 360

hdu 5702 Solving Order

hdu 5702 Solving Order题意思路源代码 题意 在程序比赛的时候,当一组AC一道题的时,便给这组与题目相对应的气球,现在给定一组气球,包括属性颜色,答对题的人数,答对题的人数越多,则题目越简单,其中气球的颜色不相同并假设每道题答对的人数也不相同,求按题目从易到难排序输出气球的颜色 思路 将气球的颜色与答对人数作为结构体,利用c++STL自带的sort方法对其排序,注意按照答对人数...

antRain的博客 225

HDU5702 Solving Order【排序】

Solving Order Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3343 Accepted Submission(s): 2032 Problem Description Welcome to HDU to take p...

海岛Blog 727

hdu 5702 Solving Order

Problem Description Welcome to HDU to take part in the first CCPC girls’ competition! As a pretty special competition, many volunteers are preparing for it with high enthusiasm. One thing they need...

qq_42819248的博客 472

B - Solving Order HDU - 5702

#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<cmath> #include<complex> #include<string> #include<algorithm> #include...

qq_41895253的博客 186

hdu 5702 Solving Order 水题

Welcome to HDU to take part in the first CCPC girls' competition! As a pretty special competition, many volunteers are preparing for it with high enthusiasm. One thing they need to do is blo

爱梦者的心之旅 559

hdu 5702 Solving Order(结构体排序 水题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5702 Solving Order Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 184    Accepted Su

若忆_star 3930

HDU 5702 Solving Order(sort结构体数组)

ACM在决赛每解决掉一个问题,会放一个气球,每个问题对应气球的颜色不同,自然,被放出的气球越多的问题,意味着它可能更容易被解决。 Input: 第一行输入测试用例的数量T 每组测试用例,先输入问题的数量N,接下来N行,每行是该问题对应的气球及放出气球数量。 Output: 对于每组测试用例,从易到难输出要解决的问题的颜色,颜色之间以空格分隔,一组测试用例对应一行输出。 AC代码: (代...

VICI的博客 140

HDU-5702-Solving Order【2016CCPC女生专场】

Solving OrderProblem Description 题目大意:给出每种颜色的名称及分值。按分值递减输出颜色名称

Linoy 1445

HDOJ--5702--Solving Order

题目描述: As a pretty special competition, many volunteers are preparing for it with high enthusiasm. One thing they need to do is blowing the balloons. Before sitting down and starting the competition, y...

猩猩是个好程序员的博客 191

【ACM】杭电OJ 1005

 题目链接:杭电OJ 1005 超时代码如下(而且开辟的数组空间大小不够): #include &lt;stdio.h&gt; int m[100000]; int f(int n,int a,int b) { m[1] = 1; m[2] = 1; for (int i = 3; i &lt;= n; i++) { m[i] = (a * m[i - 1] + b * m[i...

( :3 ) 725

结构体排序HDU 5702

Sample Input 3 3 red 1 green 2 yellow 3 1 blue 83 2 red 2 white 1 Sample Output yellow green red blue red white 题意: 输入一个字符串 一个数字 按照数字大小顺序输出字符。(从大到小) #include&lt;algorithm&gt; #incl...

qq_42964711的博客 175

"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现) HDU 5702

Solving Order Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9    Accepted Submission(s): 9 Problem Description Welcome to HDU to take

大咸鱼。。。 1004

HDOJ 5702 Clock

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5705 这是一个时针分针的追击问题,这种问题一般来说都比较烦,由于我们这题中只考虑到最近的点,所以我们一组数据如果暴力的话完全是可取的。我们先来分析时针的速度是每120秒转1度,而分针则是每10秒转1度,所以我们时针和分针的差距则是每120秒差11度,那么每过120/11秒就差1度,我们要找的就是a/

RaAlGhul的博客 558
上一篇: POJ 3172 Scales (剪枝深搜)
下一篇: HDU 5703 Desert
Kim0403
博客等级 码龄12年 25粉丝 132原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值