铂金第一题

题目:著名出题人小Q每次比赛后都会写一份《赛题分析》,包含比赛概况、每题的参考算法以及一些统计数值。
于一道题来说,小Q会统计最短的验题人代码长度(Shortest judge solution)以及赛内参赛队伍最短的AC代码长度(Shortest team solution)。
统计验题人代码长度比较容易,因为验题人最多也不会超过2020个。但是统计选手代码长度就不容易了,因为大赛区动辄三四百支队伍。
请写一个程序,帮助小Q统计最短代码长度。

分析:就将数字排序后,按照说明输出,注意输出有些空格。

`

#include<iostream>
using namespace std;
int main()
{
 int t, n, m,i,j,k;
 cin >> t;
 for (k = 1; k <= t; k++)
 {
  cin >> n >> m;
  int a[70000], b[70000];
  for (i = 0; i < n; i++)
   cin >> a[i];
  for (i = 0; i < m; i++)
   cin >> b[i];
  for (i = 0; i < n - 1; i++)
  {
   for (j = 1; j < n; j++)
   {
    int s = i;
    if (a[s] > a[j])
    {
     int t;
     t = a[s];
     a[s] =a[j];
     a[j] = t;
    }
   }
  }
  for (i = 0; i < m - 1; i++)
  {
   for (j = 1; j < m; j++)
   {
    int s = i;
    if (b[s] > b[j])
    {
     int t;
     t = b[s];
     b[s] = b[j];
     b[j] = t;
    }
   }
  }
  cout << "Problem " << k + 1000 <<":"<< endl;
  cout << "Shortest judge solution: " << a[0] << " bytes." << endl;
  if (m == 0) cout << "Shortest team solution: N/A bytes." << endl;
  if (m != 0)cout << "Shortest team solution: " << b[0] << " bytes." << endl;
 }
}
```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值