Poj1068 bracket Encoding

Source: Internet
Author: User

I want to use the stack for a long time. If I want to think about it for a long time, I just want to simulate it ........

# Include <stdio. h> # include <string. h> int N; int A [40]; void p_to_w () {int I; Int J; for (I = 0; I <2 * n; I ++) {if (a [I] = 1) {J = I-1; while (A [J]) {J --;} A [J] = 1; printf ("% d", (I-j + 1)/2) ;}} printf ("\ n") ;}int main (void) {int T; int I; int P; scanf ("% d", & T); While (t --) {memset (A, 0, sizeof ()); scanf ("% d", & N); for (I = 0; I <n; I ++) {scanf ("% d", & P ); A [p + I] = 1;} p_to_w ();} return 0 ;}

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.