Poj 1780 Euler Loop construction string

Source: Internet
Author: User

Similar to d in the Xi'an Invitational Competition

This question will pop up the stack, so non-recursive writing is required. However, after reading this question for a long time, the Code is not understood and will be rewritten later.

Question: http://blog.csdn.net/dongshimou/article/details/37815377

Http://www.cnblogs.com/372465774y/p/3200775.html

# Include <cstdio> # include <cmath> # include <iostream> using namespace STD; const int size = 100000 + 10; int A, s; int sta [size * 10], li [size * 10]; char ans [size * 10]; void sea (int v, int m) {int W; while (Li [v] <10) {W = V * 10 + Li [v]; // It is equivalent to moving one digit left, that is, the last n-1 bits of the previous number move one to the left as the first n-1 bits of the second number Li [v] ++; // The range of Li [v] is 0-9 ,, it is the V bit. Try it and make sure that it has not appeared before, because the last line of Li [v] has been used, therefore, try Li [v] + 1 sta [s ++] = W; // The answer is stored in the STA. Note that 0 indicates n-1 0 V = w % m; // shift "overflow"} int main () {int N, M; while (~ Scanf ("% d", & N) {If (n = 1) {printf ("0123456789 \ n"); continue;} int V = 0; S = A = 0; M = POW (10.0, double (n-1); For (INT I = 0; I <m; I ++) Li [I] = 0; sea (v, m); While (s) {v = sta [-- S]; ans [A ++] = V % 10 + '0'; V/= 10; sea (v, m) ;}for (INT I = 1; I <n; I ++) putchar ('0'); While () putchar (ANS [-- A]); putchar ('\ n');} return 0 ;}


Poj 1780 Euler Loop construction string

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.