程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> each-Binary String

each-Binary String

編輯:編程解疑
Binary String

問題描述 :

Give you a binary string, you can add some 1s or 0s at any places of the string. Then the result divide by K, and the remainder should be zero. Please print string of the result, if there are more, print the one with the smallest length, if still more, print the smallest lexicographical one. If there is no such result print impossible.
輸入:

No more than 10 test cases. For each test case first line is a nonempty binary string whose length is no more than 20 and without leading zeros. Next line is an integer K(1 <= K <= 200).
輸出:

No more than 10 test cases. For each test case first line is a nonempty binary string whose length is no more than 20 and without leading zeros. Next line is an integer K(1 <= K <= 200).
樣例輸入:

1000
4
11101
34
11010
70
樣例輸出:

1000
10101010
11010010

最佳回答:


http://www.acmerblog.com/hdu-2847-binary-string-4490.html

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved