• Physical Music(题意+思维)


    The music business is changing rapidly, and this is reflected by the single charts. Initially, the Dutch Single Top 100 was based purely on sale numbers of CD singles. In the course of time, however, these numbers dropped dramatically, in favour of legal and illegal downloads of music from the internet. Therefore, since 2006, downloads of singles from specific legal downloads sites are incorporated into the chart. Nowadays, even streams from certain streaming platforms contribute to the Single Top 100.

    Between 2006 and 2013, when the Single Top 100 was based on both CD singles and downloads, there was also a chart called the Download Top 100, based purely on the downloads. Assuming that both charts used the same numbers of weekly downloads, one could tell from a comparison between the two charts, which singles were selling well physically. And in fact, since some singles did not even appear as CD singles any more, one could tell which singles were certainly available as CD single: the ones that were doing better (as compared to some other singles) in the Single Top 100 than in the Download Top 100.

    Now, you are asked to write a program to determine these singles. To be prepared for other communities, which may also have single charts of other sizes, your program should not be limited to charts containing exactly one hundred singles.

    Input

    The input starts with a line containing an integer TT (1T201≤T≤20), the number of test cases. Then for each test case:

    • One line containing an integer NN, satisfying 1N1000001≤N≤100000, the size of both single charts.

    • NN lines, each containing a single integer, which together form a permutation of the numbers 1,,N1,…,N. The ii-th integer PiPi is the position in the Download Top NN of the single that is ranked ii in the Single Top NN.

    As the above specification implies, the Download Top NN and the Single Top NN contain exactly the same NN singles, possibly in different orders.

    Output

    For each test case, output:

    • One line containing the number of singles MM that are certainly available as CD single.

    • MM lines, each containing a single integer, the positions of the singles in the Download Top NN that are certainly available as CD single, in ascending order.

    Sample Input 1

    2
    3
    1
    2
    3
    4
    4
    3
    1
    2

    Sample Input 1

    0
    2
    3
    4

    题意挺绕的,有类东西有两个值,现有n个东西,一个排名,其中有些东西缺失了一个值,问缺值的东西是哪个,输出他们的排名

    #include<bits/stdc++.h>
    
    #define inf 0x3f3f3f3f
    
    using namespace std;
    
    int main()
    {
        int t, n, top, minn, i;
        int a[100005], re[100005];
        scanf("%d", &t);
        while(t--)
        {
            scanf("%d", &n);
            for(i=1; i<=n; i++)
            {
                scanf("%d", &a[i]);
            }
            top = 0;
            minn = inf;
            for(i=n; i>=1; i--)
            {
                if(a[i] < minn) minn = a[i];
                else re[top++] = a[i];
            }
            sort(re, re+top);
            printf("%d
    ", top);
            for(i=0; i<top; i++)
            {
                printf("%d
    ", re[i]);
            }
        }
        return 0;
    }
    
    
  • 相关阅读:
    chromedriver版本对应支持的Chrome版本
    post请求,直接在地址后加请求参数,并将请求参数 url加密
    Requests 请求-重定向Location
    requests 进行https请求,一直报SSL 报错,以及 移除SSL认证后的InsecureRequestWarning警告解决
    fiddler 设置,只过滤固定域名的网址
    python requests库,请求返回 中文乱码问题的解决
    python post请求,application/x-www-form-urlencoded格式,提交数据key、val均需URL转码
    python post请求,text/xml 格式
    那些年找工作入过的坑! 避雷!!!!
    构建前端gulp自动化
  • 原文地址:https://www.cnblogs.com/0xiaoyu/p/12846839.html
Copyright © 2020-2023  润新知