首页 > 编程知识 正文

美团面试几天后通知,美团笔试过了就会有面试吗

时间:2023-05-03 20:59:38 阅读:268753 作者:4180

问题描述://首先输入一个整数n,表示你要接下来输入的记录条数,接着输入n条记录。//输入:4// math 100 90// algrom 50 49// string 20 6// dp 52 10输出: algrom 5 dp 3 math 5 string 3//如上按字典序输出上面的字符串,并输出相应的级别 例如 math 100 90 x=100,y=90; x代表提交率,y代表 通过率; y/x<=30% 则难度对应级别为5 y/x<=60% 则难度对应级别为4
y/x<=100% 则难度对应级别为3
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; struct node { char st[1000]; int x;int y; }a[100000]; //字典序 此处利用c++类库的sort方法 排字典序bool cmp(node s1,node s2) { return strcmp(s1.st,s2.st)<0; } /*bool cmp1(node s1,node s2) { return strcmp(s1.st,s2.st)>0; } */ int jibie(int x,int y){ //判断改题目的难度级别float asa= y*1.0/(x*1.0);if(asa<=0.3) return 5;else if(asa<=0.6)return 4;else return 3;}int main() { int n,i=0; scanf("%d",&n); int m=n; while(n--){ scanf("%s%d%d",a[i].st,&a[i].x,&a[i].y); i++;} sort(a,a+m,cmp); //利用sort库函数,排序所有 for(int i=0;i<m;i++) printf("%s %dn",a[i].st,jibie(a[i].x,a[i].y)); return 0; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。