当前位置:网站首页>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
边栏推荐
- Go language ⌈ mutex and state coordination ⌋
- Easyswool environment configuration
- 【ValueError: math domain error】
- Common formatting problems after word writing
- LeetCode 349. Intersection of two arrays (simple, array) Day12
- Applet reads files
- ThinkPHP kernel development blind box mall source code v2 0 docking easy payment / Alibaba cloud SMS / qiniu cloud storage
- 2018 China Collegiate Programming Contest - Guilin Site J. stone game
- 智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售
- Consider defining a bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs‘
猜你喜欢

easyswoole环境配置

89 régression logistique prédiction de la réponse de l'utilisateur à l'image de l'utilisateur

Dynamic batch processing and static batch processing of unity

001_ Redis set survival time

World Book Day 𞓜 a good book that technicians should not miss (it cutting-edge technology)

校园转转二手市场源码

012_ Access denied for user ‘root‘@‘localhost‘ (using password: YES)

假如404页面是这样的 | 每日趣闻

001_redis设置存活时间

Realize linear regression with tensorflow (including problems and solutions in the process)
随机推荐
006_ redis_ Jedis quick start
013_基于Session实现短信验证码登录流程分析
010_StringRedisTemplate
leetcode:27. 移除元素【count remove小操作】
配置iptables实现本地端口转发的方法详解
Time. In ANSI standard library H header file
Today will finally write system out. Println()
Data warehouse construction table 111111
2018 China Collegiate Programming Contest - Guilin Site J. stone game
MySQL C language connection
002_ Redis_ Common operation commands of string type
Redis memory recycling strategy
【2019-CVPR-3D人体姿态估计】Fast and Robust Multi-Person 3D Pose Estimation from Multiple Views
The importance of ERP integration to the improvement of the company's system
Chinese scientists reveal a new mechanism for breaking through the bottleneck of rice yield
How many steps are there from open source enthusiasts to Apache directors?
The 16th day of sprint to the big factory, noip popularization Group Three Kingdoms game
They are all intelligent in the whole house. What's the difference between aqara and homekit?
Open3d point cloud processing
Log4j2 configuration