【比赛】第三届“传智杯”全国大学生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