zoukankan      html  css  js  c++  java
  • ZOJ4104 Sequence in the Pocket(2019浙江省赛)

    思维~

    #include<bits/stdc++.h>
    using namespace std;
    const int maxn=1e6+14;
    int a[maxn];
    int b[maxn];
    int N;
    int main () {
        int T;
        scanf ("%d",&T);
        while (T--) {
            scanf ("%d",&N);
            for (int i=1;i<=N;i++) {
                scanf ("%d",&a[i]);
                b[i]=a[i];
            }
            sort (b+1,b+N+1);
            int ans=0;
            for (int i=N;i>=1;i--) {
                if (a[i]==b[i+ans]) continue;
                else ans++;
            }
            printf ("%d
    ",ans);
        }
        return 0;
    } 
  • 相关阅读:
    练习题
    练习
    2.15
    数组
    java聊天工具12.4
    11.13(2)
    11.13
    10.30 作业
    10.23
    面向对象
  • 原文地址:https://www.cnblogs.com/zhanglichen/p/12303646.html
Copyright © 2011-2022 走看看