当前位置:网站首页>程序设计天梯赛 L1-49 天梯赛分配座位(模拟),布响丸辣
程序设计天梯赛 L1-49 天梯赛分配座位(模拟),布响丸辣
2022-04-23 02:22:00 【先求一个导】
题目
题意: 略。
思路: 麻了,已经没有脑子了。不换行,会发现是一个矩阵赋值问题,100100的,要特判最后只有一个学校的情况。
时间复杂度: O(100100)
代码:
#include<bits/stdc++.h>
using namespace std;
const int N = 102;
int n,m,k,T;
int s[N][N];
int a[N],b[N];
int mx = 0;
void solve()
{
cin>>n;
for(int i=0;i<n;++i) cin>>a[i],a[i]*=10,b[i] = a[i],mx = max(mx,a[i]);
int cnt = n;
int now = 1;
for(int j=0;j<mx;++j)
{
for(int i=0;i<n;++i)
{
if(a[i])
{
if(--a[i]==0) cnt--;
s[i][j] = now++;
if(cnt==1&&a[i]>0) now++;
}
}
}
for(int i=0;i<n;++i)
{
printf("#%d\n",i+1);
for(int j=1;j<=b[i];++j)
{
printf("%d",s[i][j-1]);
if(j%10==0) printf("\n");
else printf(" ");
}
}
}
signed main(void)
{
solve();
return 0;
}
版权声明
本文为[先求一个导]所创,转载请带上原文链接,感谢
https://blog.csdn.net/xianqiuyigedao/article/details/124356481
边栏推荐
- Multithreading technology core
- [untitled]
- LeetCode 447. Number of boomerangs (permutation and combination problem)
- 小程序 读取文件
- [leetcode daily question] 396 Rotation function
- Develop a chrome plug-in from 0 (2)
- 2018 China Collegiate Programming Contest - Guilin Site J. stone game
- 类初始化和实例初始化面试题
- ThinkPHP kernel development blind box mall source code v2 0 docking easy payment / Alibaba cloud SMS / qiniu cloud storage
- [NK] Niuke monthly race 48 D
猜你喜欢
![[chrome extender] content_ Cross domain problem of script](/img/be/7b73adc199b9c863bb5cf5a88df324.png)
[chrome extender] content_ Cross domain problem of script

Why is one plus one equal to two

手写内存池以及原理代码分析【C语言】

电源电路设计原来是这么回事

Leetcode40 - total number of combinations II

Heap overflow of kernel PWN basic tutorial

012_ Access denied for user ‘root‘@‘localhost‘ (using password: YES)
![App optimization and advanced scoreboard Part 2 [Mui + flask + mongodb]](/img/86/77b67fd28d2583e12f397430a9a62a.png)
App optimization and advanced scoreboard Part 2 [Mui + flask + mongodb]

The usage and difference of * and & in C language and the meaning of keywords static and volatile

World Book Day 𞓜 a good book that technicians should not miss (it cutting-edge technology)
随机推荐
【汇编语言】从最底层的角度理解“堆栈”
89 logistic regression user portrait user response prediction
[assembly language] understand "stack" from the lowest point of view
配置iptables实现本地端口转发的方法详解
php 2022年4月20面试题整理
Applet reads files
不断下沉的咖啡业,是虚假的繁荣还是破局的前夜?
[nk]牛客月赛48 D
On LAN
006_redis_jedis快速入门
Unity editor hierarchy drop-down menu extension
[hands on learning] network depth v2.1 Sequence model
Introduction to micro build low code zero Foundation (lesson 2)
想体验HomeKit智能家居?不如来看看这款智能生态
010_StringRedisTemplate
002_Redis_String类型常见的操作命令
VMware virtual machine installation openwrt as side route single arm route img image to vmdk
Tp6 Alibaba cloud SMS window reports curl error 60: SSL certificate problem: unable to get local issuer certificate
Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools
Open3d point cloud processing