HDU 6098 Inversion
思路:从大到小排序后,每次找到第一个下标不整出i的输出。
代码:
#include<bits/stdc++.h>
using namespace std;
#define mem(a,b) memset((a),(b),sizeof(b))
const int N=1e5+;
struct node
{
int a;
int id;
bool operator < (const node &t) const
{
return a>t.a;
}
}a[N]; int main()
{
ios::sync_with_stdio(false);
cin.tie();
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
for(int i=;i<=n;i++)
{
cin>>a[i].a;
a[i].id=i;
}
sort(a+,a+n+);
for(int i=;i<=n;i++)
{
for(int j=;j<=n;j++)
{
if(a[j].id%i!=)
{
cout<<a[j].a;
break;
}
}
if(i!=n)cout<<" ";
else cout<<endl;
}
}
return ;
}
HDU 6098 Inversion的更多相关文章
- HDU 6098 - Inversion | 2017 Multi-University Training Contest 6
/* HDU 6098 - Inversion [ 贪心,数论 ] | 2017 Multi-University Training Contest 6 题意: 求出所有B[i] = max(A[j] ...
- 2017ACM暑期多校联合训练 - Team 6 1003 HDU 6098 Inversion (模拟)
题目链接 Problem Description Give an array A, the index starts from 1. Now we want to know Bi=maxi∤jAj , ...
- HDU 6098 17多校6 Inversion(思维+优化)
Problem Description Give an array A, the index starts from 1.Now we want to know Bi=maxi∤jAj , i≥2. ...
- HDU - 6098:Inversion(暴力均摊)
Give an array A, the index starts from 1. Now we want to know B i =max i∤j A j Bi=maxi∤jAj , i≥2 i≥ ...
- HDU 1394Minimum Inversion Number 数状数组 逆序对数量和
Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- HDU 4911 Inversion
http://acm.hdu.edu.cn/showproblem.php?pid=4911 归并排序求逆对数. Inversion Time Limit: 2000/1000 MS (Java/ ...
- hdu 5497 Inversion 树状数组 逆序对,单点修改
Inversion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5497 ...
- hdu 4911 Inversion(找到的倒数)
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4911 Inversion Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 4911 Inversion (逆序数 归并排序)
Inversion 题目链接: http://acm.hust.edu.cn/vjudge/contest/121349#problem/A Description bobo has a sequen ...
随机推荐
- php7安装memchced扩展
tar -zxvf memcached-3.0.3.tgz cd memcached-3.0.3 phpize yum install libmemcached libmemcached-dev ./ ...
- Multinoulli distribution
https://www.statlect.com/probability-distributions/multinoulli-distribution3 Multinoulli distributio ...
- 20154312 曾林 EXP9 Web安全基础
目录 -0.webgoat Could not find source file -1.基础问题回答 -2.环境配置 -3.Injection Flaws ----3.1.Numeric SQL In ...
- 用Python实现随机森林算法,深度学习
用Python实现随机森林算法,深度学习 拥有高方差使得决策树(secision tress)在处理特定训练数据集时其结果显得相对脆弱.bagging(bootstrap aggregating 的缩 ...
- java和mysql之间的时间日期类型传递
摘自:http://blog.csdn.net/weinianjie1/article/details/6310770 MySQL(版本:5.1.50)的时间日期类型如下: datetime 8byt ...
- Rapid 2D-to-3D conversion——快速2D到3D转换
https://blog.csdn.net/qq_33445835/article/details/80143598 目前想做一个关于2D转3D的项目,由于国内资料比较少而且大部分都是基于国外的研究 ...
- pythoy的configparser模块
生成配置文件的模块 DEFAULT块,在以块为单位取块的值时,都会出现 import configparser config = configparser.ConfigParser() #相当于生成了 ...
- 20165310 java_blog_week2
2165310 <Java程序设计>第2周学习总结 教材学习内容总结 了解Java变量 重点学习Boolean变量和类型转换规则 学习数组定义.使用方式 区别: int [] a,b [] ...
- 20165310java_blog_week7
2165310 <Java程序设计>第7周学习总结 教材学习内容总结 通过JDBC管理数据库 原理图: 链接数据库方式 - `Connection getConnection(java.l ...
- Tomcat下使用Log4j,按日期每天存放,解决catalina.out日志文件过大问题
1. 准备jar包: log4j-1.2.17.jar (从 http://www.apache.org/dist/logging/log4j/1.2.17/ 下载) tomcat-juli.jar, ...