zoukankan      html  css  js  c++  java
  • zju1484

    蛮力水...
    #include<iostream>
    #include
    <math.h>
    #include
    <iomanip>
    #include
    <stdlib.h>
    #include
    <string>

    #include 
    <stdio.h>

    using std::fixed;
    using std::setprecision;


    using std::string;

    using std::cin;
    using std::cout;
    using std::endl;


    int main()
    {
        
    int n;
        
    while(scanf("%d",&n)!=EOF)
        
    {
            
    int Num[5000]={0};
            
    int i;
            
    int min=5000;
            
    int total=0;
            
    int large[5000]={0};
            
    int add=0;
            
    for(i=0;i<n;i++)
            
    {
                scanf(
    "%d",&Num[i]);
                
    for(int k=i-1;k>=0;k--)
                
    {
                    
    if(Num[k]>Num[i])
                        add
    ++;
                }

                total
    =total+n-1-2*Num[i];
                
    if(min>total)
                    min
    =total;

            }

            printf(
    "%d\n",add+min);
        }

        
    return 0;
    }

  • 相关阅读:
    Android-Java-构造方法内存图
    redis conf 详解
    redis windows 下安装及使用
    Python 学习笔记(一)
    python 配置
    win 7 下vim的使用
    window下安装Node.js NPM
    HashMap实现原理(转)
    mysql 常用功能
    MySql配置
  • 原文地址:https://www.cnblogs.com/SQL/p/884910.html
Copyright © 2011-2022 走看看