hdu1084(What Is Your Grade?)
来源:互联网 发布:java编程思想最新版 编辑:程序博客网 时间:2024/05/24 01:44
http://acm.hdu.edu.cn/showproblem.php?pid=1084
我的代码(ac):
#include<stdio.h>
#include<stdlib.h>
#include<memory.h>
#include<string.h>
typedef struct Node
{
int tag;
int num;
char t[10];
}Node;
int score[100];
int count[6];
Node no[100];
int cmp(const void *a,const void *b)
{
Node *c=(Node *)a;
Node *d=(Node *)b;
if(c->num!=d->num)
return c->num-d->num;
else
{
return strcmp(c->t,d->t);
}
}
int main()
{
int n,i;
int k[6];
//freopen("in.txt","r",stdin);
while(scanf("%d",&n)!=EOF)
{
if(n<0)
break;
memset(count,0,sizeof(count));
memset(k,0,sizeof(k));
for(i=0;i<n;i++)
{
scanf("%d%s",&no[i].num,no[i].t);
no[i].tag=i;
count[no[i].num]++;
}
qsort(no,n,sizeof(Node),cmp);
for(i=0;i<n;i++)
{
switch(no[i].num)
{
case 1:
k[1]++;
if(k[1]<=count[1]/2)
score[no[i].tag]=65;
else
score[no[i].tag]=60;
break;
case 2:
k[2]++;
if(k[2]<=count[2]/2)
score[no[i].tag]=75;
else
score[no[i].tag]=70;
break;
case 3:
k[3]++;
if(k[3]<=count[3]/2)
score[no[i].tag]=85;
else
score[no[i].tag]=80;
break;
case 4:
k[4]++;
if(k[4]<=count[4]/2)
score[no[i].tag]=95;
else
score[no[i].tag]=90;
break;
case 5:
score[no[i].tag]=100;
break;
default:
score[no[i].tag]=50;
}
}
for(i=0;i<n;i++)
printf("%d/n",score[i]);
printf("/n");
}
//fclose(stdin);
return 0;
}
- hdu1084(What Is Your Grade?)
- HDU1084:What Is Your Grade?
- Hdu1084 What Is Your Grade?
- HDU1084--What Is Your Grade?
- hdu1084:What is your grade?
- HDU1084 What Is Your Grade?
- hdu1084 What's your grade?
- hdu1084 What Is Your Grade? 结构体的应用
- 【结构体排序】HDU1084 What Is Your Grade?
- What Is Your Grade?
- What Is Your Grade?
- What Is Your Grade?
- what is your grade
- What Is Your Grade?
- What Is Your Grade?
- HDOJ1084 What Is Your Grade?
- hd1084 What Is Your Grade?
- 十二、What Is Your Grade?
- wince 5.0 内核启动顺序(ARM)
- iPhone App 推广网站大全
- symbian电话拦截
- Listbox
- 学习ViewState笔记
- hdu1084(What Is Your Grade?)
- Android真机调试方法
- 乐观锁和悲观锁
- oracle中用存储过程创建一张table
- 如何让zend studio 中文化
- weka 学习资料链接
- autoconf的使用,帮你如何跨各种类UNIX平台惊醒你的代码调试~
- VS2008 SP1 安装卡在 VS90sp1-KB945140-X86-CHS的解决方法
- 几个安全研究的的站点