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)