【比赛】第三届“传智杯”全国大学生IT技能大赛(初赛A组)

【比赛】第三届“传智杯”全国大学生IT技能大赛(初赛A组)

真的太水了

ak居然用了这么久我

真的太太太太菜了

哭泣

C - 志愿者

按题意排序即可

#include<bits/stdc++.h>
using namespace std;
inline int Read(){
   
	int s = 0 , w = 1;
	char ch = getchar();
	while(ch > '9' || ch < '0'){
   
		if(ch == '-') w = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
   
		s = (s << 3) + (s << 1) + ch - '0';
		ch = getchar();
	}
	return s * w;
}
const int MAXN = 5e5 + 50;
struct vol{
   
	int id,k,t;
}s[MAXN];
int n;
bool cmp(vol a,vol b){
   
	if(a.k * a.t == b.k * b.t){
   
		if(a.t == b.t){
   
			return a.id < b.id;
		}
		return a.t > b.t;
	}
	return a.k * a.t > b.k * b.t;
}
int main(){
   
	n = Read();
	for(int i = 1 ; i <= n ; i ++){
   
		s[i].t = Read() , s[i].k = Read();
		s[i].id = i;
	}
	sort(s + 1,s + 1 + n,cmp);
	for(int i = 1 ; i <= n ; i ++){
   
		printf("%d ",s[i].id);
	}
	return 0;
}

D - 终端

按题意模拟即可
用map维护

#include<bits/stdc++.h>
//#include<iostream>
//#include<map>
//#include<algorithm>
using namespace std;
inline int Read(){
   
	int s = 0 , w = 1;
	char ch = getchar();
	while(ch > '9' || ch < '0'){
   
		if(ch == '-') w = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
   
		s = (s << 3) + (s << 1) + ch - '0';
		ch = getchar();
	}
	return s * w;
}
const int MAXN = 2e3 + 50;
struct file{
   
	string name;
	bool del;
}s[MAXN];
map<string,int>mp;
int cnt,</
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值