uva上面题的的输入输出格式 各种怪 晚几天会整理下 放上。

2.8.7比赛记分板
输入 :第一行为一个整数  表示测试数据的组数,接下来一行空行。以后每两组测试数据之间一组空行隔开(各组数据的多少不确定)。最后一组数据之后是没有空行的。
输出:各组数据之间加空行。

这个输入输出 让我快吐血了!!!

代码后边跟的有测试数据。

View Code

  1 #include <iostream>  2 #include <cstdio>  3 #include <cstring>  4 #include <cmath>  5 #include <cstdlib>  6 #include <algorithm>  7 using namespace std;  8 struct ss{  9     int a,b,c,num,time; 10     char str; 11     int f[10]; 12 } node[2000],p[2001]; 13 int cmp1(ss s,ss t) 14 { 15     if(s.a==t.a&&s.b==t.b) return s.c<t.c; 16     else if(s.a==t.a) return s.b<t.b; 17     else return s.a<t.a; 18 } 19 int cmp2(ss s,ss t) 20 { 21     if(s.num==t.num&&s.time==t.time) return s.a<t.a; 22     else  if(s.num==t.num)return s.time<t.time; 23     else return s.num>t.num; 24 } 25 int main() 26 { 27     int k,n,m,i,x,y,sum=0; 28     cin>>k; 29     while(k--) 30     { 31         n=0; 32         sum++; 33         if(sum!=1)cout<<endl; 34         memset(node,0,sizeof(node)); 35         memset(p,0,sizeof(p)); 36         int f=1; 37         while (f) 38         { 39             cin>>node[n].a>>node[n].b>>node[n].c>>node[n].str; 40             n++; 41             getchar(); 42             if(cin.peek()=='\n'||cin.peek()==EOF) f=0; 43         } 44         sort(node,node+n,cmp1); 45         x=y=0; 46         m=0; 47         p[m++]=node[0]; 48         x=node[0].b; 49         if(node[0].str=='C'){ p[m-1].num+=1;p[m-1].time+=p[m-1].c;p[m-1].f[x]=1;} 50         if(node[0].str=='I') y=1; 51         for(i=1;i<n;i++) 52         { 53             if(p[m-1].a==node[i].a) 54             { 55                 if(node[i].b==x&&p[m-1].f[x]!=1) 56                 { 57                     if(node[i].str=='C'&&p[m-1].f[x]!=1) 58                     { 59                         p[m-1].num+=1; 60                         p[m-1].time+=(y*20+node[i].c); 61                         p[m-1].f[x]=1; 62                         y=0; 63                     } 64                     if(node[i].str=='I'&&p[m-1].f[x]!=1)y++; 65                 } 66                 else if(node[i].b!=x) 67                 { 68                     x=node[i].b; 69                     if(node[i].str=='C'){ p[m-1].num+=1;p[m-1].time+=node[i].c;p[m-1].f[x]=1;} 70                     if(node[i].str=='I'&&p[m-1].f[x]!=1) y=1; 71                 } 72  73             } 74             else 75             { 76                 p[m++]=node[i]; 77                 x=node[i].b; 78                 y=0; 79                 if(node[i].str=='C'){ p[m-1].num+=1;p[m-1].time+=node[i].c;p[m-1].f[x]=1;} 80                 if(node[i].str=='I'&&p[m-1].f[x]!=1) y=1; 81             } 82         } 83         sort(p,p+m,cmp2); 84         for(i=0;i<m;i++) 85         { 86             if(p[i].num>0) 87                 cout<<p[i].a<<" "<<p[i].num<<" "<<p[i].time<<endl; 88             else  cout<<p[i].a<<" 0 0"<<endl; 89         } 90     } 91     return 0; 92 } 93  94  95 /* 96 2 97  98 1 2 10 I 99 3 1 11 C100 1 2 19 R101 1 2 21 C102 1 1 25 C103 104 1 2 10 I105 3 1 11 C106 1 2 19 R107 1 2 21 C108 1 1 25 C109 5110 111 1 1 20 C112 1 1 21 C113 1 1 22 I114 1 1 23 C115 116 1 2 10 I117 3 1 11 C118 1 2 19 R119 1 2 21 C120 1 1 25 C121 1 3 20 I122 1 4 40 I123 8 4 50 I124 125 1 2 10 I126 3 1 11 C127 1 2 19 R128 1 2 21 C129 1 1 25 C130 6 1 30 R131 132 1 3 20 I133 1 3 25 C134 2 5 30 R135 136 1 2 10 R137 2 4 15 U138 3 1 20 E139 1 2 22 I140 */141 /*142 4143 144 1 2 10 I145 3 1 11 C146 1 2 19 R147 1 2 21 C148 1 1 25 C149 150 1 1 5 C151 1 2 10 C152 1 3 15 C153 100 1 0 I154 100 1 5 C155 100 3 50 C156 38 1 0 C157 48 1 1 R158 83 1 2 E159 89 9 3 R160 7 5 4 R161 68 1 5 U162 61 1 6 U163 27 1 7 R164 21 7 8 R165 55 2 9 I166 54 1 10 U167 69 1 11 C168 59 2 12 I169 43 3 13 I170 7 9 14 R171 84 6 15 R172 52 8 16 C173 32 7 17 C174 87 7 18 U175 44 1 19 I176 87 6 20 I177 21 6 21 U178 6 4 22 E179 44 8 23 I180 72 5 24 R181 35 1 25 E182 57 4 26 E183 24 5 27 C184 30 3 28 I185 85 9 29 I186 72 5 30 U187 30 7 31 U188 8 5 32 R189 88 1 33 I190 61 2 34 C191 35 6 35 R192 77 4 36 C193 46 8 37 I194 21 9 38 E195 74 3 39 R196 7 4 40 U197 25 4 41 R198 48 1 42 I199 87 1 43 C200 84 3 44 U201 96 9 45 U202 60 5 46 R203 75 2 47 I204 29 4 48 E205 3 7 49 I206 207 3 1 11 C208 3 1 17 I209 210 1 2 10 I211 3 1 10 I212 1 2 11 C213 3 1 11 C214 1 4 20 I215 216 1 2 66217 3 1 11218 219 1 3 30220 100 2 75221 38 1 0222 69 1 11223 52 1 16224 32 1 17225 24 1 27226 61 1 34227 77 1 36228 87 1 43229 3 0 0230 6 0 0231 7 0 0232 8 0 0233 21 0 0234 25 0 0235 27 0 0236 29 0 0237 30 0 0238 35 0 0239 43 0 0240 44 0 0241 46 0 0242 48 0 0243 54 0 0244 55 0 0245 57 0 0246 59 0 0247 60 0 0248 68 0 0249 72 0 0250 74 0 0251 75 0 0252 83 0 0253 84 0 0254 85 0 0255 88 0 0256 89 0 0257 96 0 0258 259 3 1 11260 261 1 1 31262 3 1 31263 */

转载于:https://www.cnblogs.com/zhaoguanqin/archive/2012/03/02/2376530.html

PC/UVA 110207/10258相关推荐

  1. PC/UVa 题号: 110106/10033 Interpreter (解释器)题解 c语言版

    学到两个: //ignore \n cin.ignore(); //ignore a line cin.ignore(1024, '\n'); #include<cstdio> #incl ...

  2. PC/UVa 题号: 110101/100 3n+1 Problem

    不解释了,暴力,不过需要注意的是 i有可能大于j #include <stdio.h> #include <string.h> #define maxnum 1000001 l ...

  3. UVa Problem 10310 Dog and Gopher (狗拿地鼠)

    // Dog and Gopher (狗拿地鼠) // PC/UVa IDs: 111301/10310, Popularity: A, Success rate: average Level: 1 ...

  4. UVa Problem 10001 Garden of Eden (伊甸园)

    // Garden of Eden (伊甸园) // PC/UVa IDs: 110806/10001, Popularity: B, Success rate: average Level: 2 / ...

  5. UVa Problem 10041 Vito’s Family (Vito 家族)

    // Vito's Family (Vito 家族) // PC/UVa IDs: 110401/10041, Popularity: A, Success rate: high Level: 1 / ...

  6. UVa Problem 10254 The Priest Mathematician (牧师数学家)

    // The Priest Mathematician (牧师数学家) // PC/UVa IDs: 110606/10254, Popularity: C, Success rate: high L ...

  7. UVa Problem 10067 Playing With Wheels (摆弄轮子)

    // Playing With Wheels (摆弄轮子) // PC/UVa IDs: 110902/10067, Popularity: C, Success rate: average Leve ...

  8. UVa Problem 10205 Stack ’em Up (完美洗牌术)

    // Stack 'em Up (完美洗牌术) // PC/UVa IDs: 110205/10205, Popularity: B, Success rate: average Level: 1 / ...

  9. (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO

    下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinej ...

最新文章

  1. 在计算机检索系统中常用的检索技术有,计算机检索技术有哪些
  2. 【BZOJ1123】 [POI2008]BLO (tarjan)
  3. mysql5.7 server id_三台mysql5.7服务器互作主从配置案例
  4. Visual Studio 编译优化选项:Debug与Release、禁止优化与O1、O2、Ox优化
  5. npm run dev/build/serve
  6. xadmin的html文件,django xadmin(2) 在xadmin基础上完成自定义页面
  7. Java包hashCode()方法及示例
  8. metadata.js
  9. 面试问题:SpringMVC的执行流程
  10. 荐书送书丨《PostgreSQL实战》、《PostgreSQL修炼之道:从小工到专家(第2版)》...
  11. 如何让产品用户拥有一流的上传体验
  12. springmvc或者springboot 中实现跨域的5种方式
  13. android monkey测试步骤,android Monkey 测试技巧
  14. Android设置Textview字体样式
  15. Win10设置不能保存,添加应用磁贴重启后恢复原状问题
  16. 只有程序员才能读懂的西游记(不看后悔一生)
  17. 什么是学习能力?如何提高学习能力?
  18. 使用高德地图api在页面中展示地图
  19. 任务的创建与执行-4
  20. ftp协议c语言实现-linux平台

热门文章

  1. python_day26__02__文件的传送
  2. oracle11g之管理oracle数据库笔记(理论基础知识)
  3. 求排列组合数C(n,m) φ(゜▽゜*)♪
  4. 漫水填充算法 - cvFloodFill() 实现
  5. Windows 8 / 8.1 禁用驱动签名最详细图文教程
  6. 最新zendframework1.11使用
  7. 主流框架中DOMContentLoaded事件的实现
  8. 生成可执行jar文件
  9. 分析一个软件要考虑的问题
  10. Linux的IPC机制(三):Binder