hdu2093
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
using namespace std;
int m;
struct node{
char name[];
int time,acno; }p[];
bool cmp(node a,node b){
if(a.acno==b.acno&&a.time==b.time) return (strcmp(b.name,a.name)>);
else if(a.acno==b.acno) return a.time<b.time;
else return a.acno>b.acno;
}
int change(char tmp[]){
int sum,res=,i,t=,k,j;
double cnt;
int l=strlen(tmp);
if(tmp[l-]==')'){
cnt=;
for(i=l-;tmp[i]!='(';--i){
k=;
for(j=;j<cnt;++j)
k*=;
t+= k * (tmp[i]-'');
cnt=cnt+;
}
tmp[i]='\0';
l=strlen(tmp);
}
cnt=;
for(i=l-;i>=;--i){
k=;
for(j=;j<cnt;++j)
k*=;
res+= k * (tmp[i]-'');
cnt=cnt+;
}
return res+t*m;
}
int main(){
int n,i,j,cnt=;
while(~scanf("%d%d",&n,&m)){
cnt=;
char tmp[];
for(j=;j<;++j){
scanf("%s",p[cnt].name);
p[cnt].acno=;
p[cnt].time=;
for(i=;i<n;++i){
scanf("%s",tmp);
if(tmp[]=='-'||tmp[]=='') continue;
else p[cnt].time+= change(tmp);
p[cnt].acno++;
}
cnt++;
}
sort(p,p+cnt,cmp);
for(i=;i<cnt;++i){
printf("%-10s %2d %4d\n",p[i].name,p[i].acno,p[i].time); }
}
return ;
}
hdu2093的更多相关文章
- HDU2093 字符串2种不错的读入思路
<span style="font-family: 'Times New Roman'; font-size: 12px; background-color: rgb(255, 255 ...
- hdu2093 考试排名(还需完善)
下面代码是借鉴的.好多的知识点等着完善 #include <iostream> #include <string> #include <algorithm> usi ...
- OJ题目分类
POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...
- hdu2090-2097
hdu2090 模拟 #include<stdio.h> int main(){ ]; ,a1,a2; ; while(scanf("%s%lf%lf",b,& ...
随机推荐
- JS常用各种正则表达式
1.非负整数 /^\d+$/ 2.正整数 /^[0-9]*[1-9][0-9]*$/ 3.非正整数 /^((-\d+)|(0+))$/ 4.负整数 ...
- redis批量删除
./redis-cli -p 6379 -a password keys "*_icp" | xargs redis-cli -p 6379-a password del 删除所有 ...
- PopuWindow_2
点击一个popupwindow窗口之外的区域popupwindow消失,带来的问题!! popupwindow窗口之外的区域popupwindow消失 , 以前说过需要设置: mPopupWindow ...
- ADO.NET Entity Framework(EF)
ylbtech-Miscellaneos: ADO.NET Entity Framework(EF) A,返回顶部 1, ADO.NET Entity Framework 是微软以 ADO.NET 为 ...
- js让iframe高度自动
HTML: <iframe id="yb_if" width="940px" src="连接" frameborder=0 allow ...
- Android之SQLite
在模拟器运行的情况下,进入cmd运行adb shell 可进入模拟器的linux系统输入 lite3 mars_test_db 可进入sqlite模式.schema或者.sch 查看有哪些表 SQLi ...
- 适配6 、6P 来源互联网
iPhone 6 6P出现后,如何将一份设计稿支持多个尺寸? 如何只出一套iOS平台设计稿?随着苹果发布两种新尺寸的大屏iPhone 6,下面三款iPhone尺寸和分辨率数据就知道屏幕有多杂了. 现在 ...
- aria-expanded,aria-hidden到底做什么用?
aria-expanded表示展开状态.默认为undefined, 表示当前展开状态未知.其它可选值:true表示元素是展开的:false表示元素不是展开的. aria-hidden字符串.可选值为t ...
- Troubleshooting 'library cache: mutex X' Waits.
What is a 'library cache: mutex X' wait? The mutex feature is a mechanism to control access to in me ...
- ownDocument和documentElement
<!DOCTYPE html> <html> <head> <meta name="viewport" content="wid ...