当前位置:网站首页>程序设计天梯赛 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
边栏推荐
- They are all intelligent in the whole house. What's the difference between aqara and homekit?
- IAR嵌入式開發STM32f103c8t6之點亮LED燈
- 【2019-CVPR-3D人体姿态估计】Fast and Robust Multi-Person 3D Pose Estimation from Multiple Views
- PTA: praise the crazy devil
- 006_ redis_ Sortedset type
- 010_ StringRedisTemplate
- So library dependency
- 005_ redis_ Set set
- wordpress 调用指定页面内容详解2 get_children()
- Realize linear regression with tensorflow (including problems and solutions in the process)
猜你喜欢
Gray scale range corresponding to colors (red, yellow, green, blue, purple, pink, brick red and magenta) in HSV color space
每日一题冲刺大厂第十六天 NOIP普及组 三国游戏
Talk about biology live broadcast: Dr. Wang Ziyuan, a lake view biology, exploring hepatitis B with gene therapy
Dynamic batch processing and static batch processing of unity
校园转转二手市场源码
[assembly language] understand "stack" from the lowest point of view
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
005_redis_set集合
If 404 page is like this | daily anecdotes
随机推荐
中金财富跟中金公司是一家公司吗,安全吗
New book recommendation - IPv6 technology and application (Ruijie version)
009_Redis_RedisTemplate入门
配置iptables实现本地端口转发的方法详解
Log4j2 configuration
Esp32 message queue using FreeRTOS
hyperscan --- 1
Flink real-time data warehouse project - Design and implementation of DWS layer
Daily question (April 22, 2022) - rotation function
从0开始开发一个chrome插件(2)
Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools
Consider defining a bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs‘
Numerical remapping method (remap)
MySQL C language connection
How to configure iptables to realize local port forwarding
Applet reads files
Unicorn bio raised $3.2 million to turn prototype equipment used to grow meat into commercial products
openstack 服务的启动
PTA: 点赞狂魔
If 404 page is like this | daily anecdotes