当前位置:网站首页>Program design: l1-49 ladder race, allocation of seats (simulation), Buxiang pill hot
Program design: l1-49 ladder race, allocation of seats (simulation), Buxiang pill hot
2022-04-23 02:22:00 【Find a derivative first】
subject
The question : A little .
Ideas : It's numb , I have no brain . Don't wrap , It will be found that it is a matrix assignment problem ,100100 Of , There is only one school in the end .
Time complexity : O(100100)
Code :
#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;
}
版权声明
本文为[Find a derivative first]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230222217214.html
边栏推荐
- Kubernetes cluster installation based on Kirin SP10 server version
- Fast and robust multi person 3D pose estimation from multiple views
- arduino esp8266 网络升级 OTA
- [nk]牛客月赛48 D
- 011_RedisTemplate操作Hash
- Common formatting problems after word writing
- Daily question (April 22, 2022) - rotation function
- How to call out services in idea and display the startup class in services
- PTA: praise the crazy devil
- VMware virtual machine installation openwrt as side route single arm route img image to vmdk
猜你喜欢

So library dependency

Leetcode40 - total number of combinations II

006_redis_jedis快速入门

Shardingsphere read write separation

Dynamic batch processing and static batch processing of unity

010_ StringRedisTemplate
Unicorn bio raised $3.2 million to turn prototype equipment used to grow meat into commercial products

Lane cross domain problem

Daily question (April 22, 2022) - rotation function

006_redis_SortedSet类型
随机推荐
想用Mac学习sql,主要给自己个充足理由买Mac听听意见
tp6阿裏雲短信 window 報 cURL error 60: SSL certificate problem: unable to get local issuer certificate
我国科学家揭示突破水稻产量瓶颈新机制
Heap overflow of kernel PWN basic tutorial
They are all intelligent in the whole house. What's the difference between aqara and homekit?
Tp6 Alibaba cloud SMS window reports curl error 60: SSL certificate problem: unable to get local issuer certificate
[Dahua cloud native] micro service chapter - service mode of five-star hotels
【无标题】
php 2022年4月20面试题整理
89 logistic regression user portrait user response prediction
配置iptables实现本地端口转发的方法详解
WordPress calls the specified page content. 2 get_ children()
【Chrome扩展程序】content_script的跨域问题
Numerical remapping method (remap)
IAR嵌入式开发STM32f103c8t6之点亮LED灯
PHP sorting of interview questions on April 20, 2022
世界读书日 | 技术人不要错过的好书(IT前沿技术)
Synchronized锁及其膨胀
都是做全屋智能的,Aqara和HomeKit到底有什么不同?
智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售