NYOJ-682 Xiao Yuan in efforts (Zhengda University the sixth annual School game simulation)

Source: Internet
Author: User

Link: click here

Test instructions

description
input
input contains multiple sets of data, and the first line of a number T represents the number of input samples.

Each set of samples starts with a number M < 10^7 represents the number of numbers in this set of data, and the next m number represents the number to be compressed (the number does not exceed the range represented by int).
output
Each set of test data outputs a pair of digits, as described above. Two numbers are separated by a space.
Sample Input
19 1 1 1 2 3 3 3 3 3 
sample Output
3 1 1 2 5 3 
source
Zhengda University Sixth annual school tournament
Idea: See this problem again, a little new view, just started to open two arrays of pure simulation, a violent, the results returned to ultra-memory, to pay attention to the data is a bit large, to transform thinking, on the code:

Code:

#include <stdio.h> #include <string.h>//int aa[10000000],bb[10000000];int main () {    //freopen ("11.txt "," R ", stdin);    Freopen ("22.txt", "w", stdout);    int  n,m,k,p,i,j;    int sum=0,u=0;    scanf ("%d", &n);    while (n--)    {         j=1;        scanf ("%d", &m);        scanf ("%d", &k);        for (i=0;i<m-1;i++)        {            scanf ("%d", &p);           if (p!=k)           {               printf ("%d%d", j,k);               k=p;j=1;           }           else J + +;        }        printf ("%d%d\n", j,k);    }    return 0;}


NYOJ-682 Xiao Yuan in efforts (Zhengda University the sixth annual School game simulation)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.