锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品久久久久久亚洲精品,久久综合狠狠综合久久,国产真实乱对白精彩久久http://www.shnenglu.com/lvlawliet/articles/158393.htmlLLawlietLLawlietSat, 15 Oct 2011 14:15:00 GMThttp://www.shnenglu.com/lvlawliet/articles/158393.htmlhttp://www.shnenglu.com/lvlawliet/comments/158393.htmlhttp://www.shnenglu.com/lvlawliet/articles/158393.html#Feedback0http://www.shnenglu.com/lvlawliet/comments/commentRss/158393.htmlhttp://www.shnenglu.com/lvlawliet/services/trackbacks/158393.html

Max Xor Sub-sequence II 
Time Limit:1000MS  Memory Limit:32768K

Description:

Give you a sequence of integer numbers which are 1 or 0. You are to find the number of consecutive sub-sequence, which the xor value between all these numbers has the maximum value. The first number of the sequence is 1 and the last is 1. There are (n+1) 1’s in the sequence. N numbers will be given. The i-th number is the index of (i+1)-th 1 minus the index of i-th 1. For example: if the sequence is 1010100010001, 4 2 2 4 4 will be given.

 

Input:

There are multiple cases. For each case: Line 1: A single integer N (1<=N<=20000). Followed N integers ranging from 1 to 20000.

Output:

For each case output the result in a single line.

Sample Input:

4
2 2 4 4
5
3 1 2 4 5

Sample Output:

49
70

Hint:

1.1 ^ 1 = 0, 1 ^ 0 = 1, 0 ^ 1 = 1, 0 ^ 0 = 0. 2.In the example, sub-sequence 10 has the maximum value ‘cause 1 xor 0 = 1;the same as 10101, 1010100010001, and so on.

綆椾笉涓奃P鐨凞P......灝辨槸澶勭悊01涓茬殑濂囧伓鎬?....
DP[i][j]琛ㄧず絎琲涓?錛宩鏈?縐嶆儏鍐點?/span>
dp[i][0] = dp[i - 1][1] 琛ㄧず鍋舵暟涓?錛屼笖鏈鍚庝竴涓?鍦ㄦ湯灝俱?/span>
dp[i][1] = dp[i - 1][0] + dis 琛ㄧず濂囨暟涓?錛屼笖鏈鍚庝竴涓?鍦ㄦ湯灝俱?/span>
dp[i][2] = f[i - 1][2] + f[i - 1][0] 琛ㄧず鍋舵暟涓?錛屼笖鏈鍚庝竴涓?涓嶅湪鏈熬銆?/span>
dp[i][3] = f[i  - 1][3] + f[i - 1][1] 琛ㄧず鍋舵暟涓?錛屼笖鏈鍚庝竴涓?涓嶅湪鏈熬銆?/span>
dp[i][4] = f[i - 1][4] + (dis - 1) * f[i - 1][0] 琛ㄧず鍋舵暟涓?錛屼笖鏈鍚庝竴涓槸0涓嶅湪鏈熬銆?/span>
dp[i][5] = f[i - 1][5] + (dis - 1) * f[i - 1][0] 琛ㄧず鍋舵暟涓?錛屼笖鏈鍚庝竴涓槸0涓嶅湪鏈熬銆?/span>
涓婇潰鍏釜鍏崇郴寮忓垪涓句簡鎵浠ユ儏鍐碉紝浣嗘槸鍙敤鍒頒簡(dp[i][0], dp[i][1], dp[i][3], dp[i][5])鍥涗釜寮忓瓙銆?br />
鍙嬫儏鎻愮ず錛宎ns鏄秴榪噄nt鐨勶紝鐢╨ong long鍚э紝鎴戝洜涓鴻繖涓悆浜嗕笁嬈A.....

浠g爜錛?/span>

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int main()
{
    long long dp[20010][7];
    long long n;
    long long dis;
    while (cin >> n)
    {
        memset(dp, 0, sizeof(dp));
        dp[1][0] = 0;
        dp[1][1] = 1;
        for (long long i = 2; i <= n + 1; ++i)
        {
            cin >> dis;
            dp[i][0] = dp[i - 1][1];
            dp[i][1] = dp[i - 1][0] + dis;
            dp[i][3] = dp[i - 1][3] + dp[i - 1][1];
            dp[i][5] = dp[i - 1][5] + (dis - 1) * dp[i - 1][1];
        }
        cout << dp[n + 1][1] + dp[n + 1][3] + dp[n + 1][5] << endl;
    }
    return 0;
}



LLawliet 2011-10-15 22:15 鍙戣〃璇勮
]]>
HUST1380:NumberPyramidshttp://www.shnenglu.com/lvlawliet/articles/158392.htmlLLawlietLLawlietSat, 15 Oct 2011 14:15:00 GMThttp://www.shnenglu.com/lvlawliet/articles/158392.htmlhttp://www.shnenglu.com/lvlawliet/comments/158392.htmlhttp://www.shnenglu.com/lvlawliet/articles/158392.html#Feedback0http://www.shnenglu.com/lvlawliet/comments/commentRss/158392.htmlhttp://www.shnenglu.com/lvlawliet/services/trackbacks/158392.html

NumberPyramids

Time Limit: 20 Sec  Memory Limit: 128 MB
Submissions: 103  Solved: 41

Description

 

Suppose that there are N numbers written in a row. A row above this one consists of N-1 numbers, the i-th of which is the sum of the i-th and (i+1)-th elements of the first row. Every next row contains one number less than the previous one and every element is the sum of the two corresponding elements in the row below. The N-th row contains a single number. For example, if the initial numbers are {2,1,2,4}, the whole structure will look like this:

15
6 9
3 3 6
2 1 2 4

We shall refer to such a structure as a number pyramid. Two number pyramids are equal if all the numbers at corresponding positions are equal. Given ints baseLength and top, compute the total number of different number pyramids consisting of positive integers, having baseLength elements in the first row and the value at the top equal to top. Since the number of such pyramids might be enormous, return the result modulo 1,000,000,009.

 

Input

 

Two numbers -- baseLength and top.
baseLengthwill be between 2 and 1,000,000, inclusive.
topwill be between 1 and 1,000,000, inclusive.

 

Output

 

The total number of different number pyramids Constraints

 

Sample Input

3 5
5 16
4 15
15 31556
150 500

Sample Output

2
1
24
74280915
0

HINT

 

1) The following are two possible pyramids with 3 numbers in the base and the number 5 at the top:

2) The only number pyramid with base of size 5 and 16 at the top looks like this:

 

Source

Topcoder SRM





闈炲父V5鐨勪竴閬撻錛屼竴寮鏄互涓轟絾鏄疍P錛?,000,000鐨勬暟鎹寖鍥寸湡鐨勬湁鐐逛笉鑳芥帴鍙?.....
鐪嬩簡涓涓ぇ鐗涚殑棰樿В錛岀敤鏁拌璇佹槑浜嗚繖涓鍙互杞寲鎴愬閲嶈儗鍖?....

鎬濊礬錛?br />棣栧厛錛屾垜浠彲浠ヨ瘉鏄庨噾瀛楀鏈欏剁鐨勬暟鍜屾渶浣庣鐨勬暟鏄湁鍏崇郴鐨勶紝鍏崇郴灝辨槸
C0N-1*a0 + C1N-1*a1 + C2n-1*a2 + ...... Cn-1n-1*an-1 = T      錛?錛?/sub>

鑰屼笖鍥犱負T <= 1,000,000銆傚彲浠ユ帹鍑簄鏈澶ф槸20.....
緇х畫瑙傚療涓婅堪錛?錛夛紝鍥犱負蹇呴』絎﹀悎閲戝瓧濉旓紝鎵浠搴忓垪閮借嚦灝戜負1錛屾墍浠ワ紝鎴戜滑鍙互鍙戠幇錛屽厛鐢═鍑忓幓姣忎釜緋繪暟錛堝洜涓鴻嚦灝戜竴嬈★級錛屼箣鍚庣敤閭-1涓暟鍋氬閲嶈儗鍖咃紝姹俆鐨勬柟妗堝氨琛屼簡銆?br />
澶嶆潅搴︽槸(N * 1,000,000)錛屽彲浠ユ帴鍙椼?br />
浠g爜錛?br />
#include <cstdio>
#include 
<cstring>
#include 
<iostream>
using namespace std;

const int mod = 1000000009;
int dp[1000100];
int n, top;
int c[21][21];
void init()
{
    
for (int i = 1; i < 21++i)
    {
        c[i][
0= c[i][i]  = 1;
        c[i][
1= c[i][i - 1= i;
        
for (int j = 2; j < i - 1++j)
        {
            c[i][j] 
= c[i - 1][j] + c[i - 1][j - 1];
        }
    }
}

int work(int n, int top)
{
    
if (n > 20return 0;
    
if (1 << (n - 1> top) return 0;
    top 
-= 1 << (n - 1);
    memset(dp, 
0sizeof(dp));
    dp[
0= 1;
    
for (int i = 0; i <= n - 1++i)
    {
        
for (int k = 0; k <= top; ++k)
        {
            
if ((dp[k] && k + c[n - 1][i] <= top) || k == 0)
            {
                dp[k 
+ c[n - 1][i]] = (dp[k + c[n - 1][i]] + dp[k]) % mod;
            }
        }
    }
    
return dp[top];
}

int main()
{
    memset(c, 
-1sizeof(c));
    init();
    
while (scanf("%d%d"&n, &top) != EOF)
    {
        printf(
"%d\n", work(n ,top));
    }
    
return 0;
}



LLawliet 2011-10-15 22:15 鍙戣〃璇勮
]]>
HDU3022:Sum of Digitshttp://www.shnenglu.com/lvlawliet/articles/158391.htmlLLawlietLLawlietSat, 15 Oct 2011 14:14:00 GMThttp://www.shnenglu.com/lvlawliet/articles/158391.htmlhttp://www.shnenglu.com/lvlawliet/comments/158391.htmlhttp://www.shnenglu.com/lvlawliet/articles/158391.html#Feedback0http://www.shnenglu.com/lvlawliet/comments/commentRss/158391.htmlhttp://www.shnenglu.com/lvlawliet/services/trackbacks/158391.html

Sum of Digits

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 149    Accepted Submission(s): 46


Problem Description
Petka thought of a positive integer n and reported to Chapayev the sum of its digits and the sum of its squared digits. Chapayev scratched his head and said: "Well, Petka, I won't find just your number, but I can find the smallest fitting number." Can you do the same?
 

Input
The first line contains the number of test cases t (no more than 10000). In each of the following t lines there are numbers s1 and s2 (1 ≤ s1, s2 ≤ 10000) separated by a space. They are the sum of digits and the sum of squared digits of the number n.
 

Output
For each test case, output in a separate line the smallest fitting number n, or "No solution" if there is no such number or if it contains more than 100 digits.
 

Sample Input
4 9 81 12 9 6 10 7 9
 

Sample Output
9 No solution 1122 111112
 

Source
 

Recommend
gaojie
 

鏍規嵁output鐨勬彁紺猴紝緇撴灉涓嶅彲鑳藉ぇ浜?00浣嶏紝鎴戜滑鍙互鐚滃嚭錛宻1鏈澶у氨鏄?00錛宻2鏈澶ф槸8100錛屾墍浠ワ紝瀹屽叏鍙互(s1 * s2)鐨勫鏉傚害銆?/span>
dp[i][j] = min(dp[i - k][j - k * k] + 1, dp[i][j])錛屽叾涓璱琛ㄧず鍜岋紝j琛ㄧず騫蟲柟鍜屾槸錛宬琛ㄧず澶氬嚭鏈楂樹綅鏄痥錛宒p鏁扮粍璁板綍浣嶆暟錛屽悓鏃跺紑涓涓猟鏁扮粍璁板綍鍙鏂規鐨勯浣嶃?br />
鏍規嵁璐績鎬濇兂錛岃緇撴灉鏈灝忥紝鎵浠ュ厛灝介噺姹傚嚭鏈灝忕殑浣嶆暟錛屼箣鍚庢牴鎹綅鏁版瀯閫犳渶灝忕殑鏁般傚緱鍑烘渶灝忎綅鏁板悗錛屽彲浠ラ掑綊姹傚嚭絳旀錛坉鏁扮粍璁板綍鐨勬槸鍙鏂規鐨勯浣嶏紝鎵浠ラ掑綊寰堝ソ瀹炵幇銆傦級

浠g爜錛?br />
#include <iostream>
#include 
<cstdio>
#include 
<cstring>
#include 
<cmath>
using namespace std;

int dp[901][8101], d[901][8101];
int T, n, m;

int main()
{
    memset(dp, 
0sizeof(dp));
    
for (int i = 1; i <= 9++i)
    {
        dp[i][i 
* i] = 1;
        d[i][i 
* i] = i;
    }
    
for (int i = 1; i <= 900++i)
    {
        
for (int j = i; j <= 8100++j)
        {
            
for (int k = 1; k <= 9++k)
            {
                
if (i < k || j < k * k) break;
                
if (dp[i - k][j - k * k] == 0 || dp[i - k][j - k * k] == 100continue;
                
if (dp[i][j] == 0 || dp[i - k][j - k * k] + 1 < dp[i][j])
                {
                    dp[i][j] 
= dp[i - k][j - k * k] + 1;
                    d[i][j] 
= k;
                }
            }
        }
    }
    scanf(
"%d"&T);
    
while (T--)
    {
        scanf(
"%d%d"&n, &m);
        
if (n > 900 || m > 8100 || dp[n][m] == 0)
        {
            printf(
"No solution\n");
            
continue;
        }
        
while (dp[n][m])
        {
            
int dig = d[n][m];
            printf(
"%d", dig);
            n 
-= dig;
            m 
-= dig * dig;
        }
        printf(
"\n");
    }
    
return 0;
}


LLawliet 2011-10-15 22:14 鍙戣〃璇勮
]]>
HDU2929:Bigger is Betterhttp://www.shnenglu.com/lvlawliet/articles/158390.htmlLLawlietLLawlietSat, 15 Oct 2011 14:14:00 GMThttp://www.shnenglu.com/lvlawliet/articles/158390.htmlhttp://www.shnenglu.com/lvlawliet/comments/158390.htmlhttp://www.shnenglu.com/lvlawliet/articles/158390.html#Feedback0http://www.shnenglu.com/lvlawliet/comments/commentRss/158390.htmlhttp://www.shnenglu.com/lvlawliet/services/trackbacks/158390.html

Bigger is Better

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 559    Accepted Submission(s): 155


Problem Description
Bob has n matches. He wants to compose numbers using the following scheme (that is, digit 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 needs 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 matches):

Write a program to make a non-negative integer which is a multiple of m. The integer should be as big as possible.
 

Input
The input consists of several test cases. Each case is described by two positive integers n (n ≤ 100) and m (m ≤ 3000), as described above. The last test case is followed by a single zero, which should not be processed.
 

Output
For each test case, print the case number and the biggest number that can be made. If there is no solution, output -1.Note that Bob don't have to use all his matches.
 

Sample Input
6 3 5 6 0
 

Sample Output
Case 1: 111 Case 2: -1
 

Source
 

Recommend
lcy
 
06騫村尯鍩熻禌錛岃タ瀹夎禌鍖虹殑B棰橈紝浣沖摜鍑虹殑錛岀妧鍒╃殑DP銆?br />涓寮濮嬬湅姝ら錛岃涓烘槸鏁板鏂規硶鍔犳瀯閫犵瓟妗堬紝鎺ㄤ簡涓浼氬氨鏀懼純浜嗭紝涔嬪悗鐪嬩簡鍚屽満閭i亾緗戠粶嫻佺殑棰橈紝涓嶈繃閴翠簬鎴戝浜庨偅閬撶綉緇滄祦鎬濊礬鐩稿綋鎭跺績錛屽氨榪斿洖緇х畫鎬濊冭繖閬撻銆?br />涔嬪悗錛屽彂鐜拌繖閬撻鍙互濂楃敤鎴戞槰澶╅偅閬揇P鐨勮漿縐繪柟紼嬨?br />dp[i][j] = max{dp[i][j],  dp[i + a[k]][(j * 10 + k) % m]}錛屽叾涓紝i琛ㄧず鐢ㄤ簡i涓湪媯嶏紝j琛ㄧずi涓湪媯嶆瀯鎴愮殑鏁癿od m鍚庢槸j錛宒p[i][j]琛ㄧず鏋勬垚榪欎釜鏈澶ф暟鐨勯暱搴︺傦紙鍥犱負鏄眰mod錛屽彲浠ユ兂鍒板彇mod鍚庣殑鐘舵侊紝榪欐牱鍙互鏈夋晥鐨勫噺灝戠姸鎬佹暟鐩傦級
璇翠竴涓嬩匠鍝ラ瑙o紝涔熸槸璁╂垜WA浜嗘棤鏁版鐨勫潙銆?br />鍏充簬閭d釜dp[i][j]鐨勮漿縐伙紝鎴戜滑鍙互鐪嬪嚭姣忔杞Щ鐨勬椂鍊欙紝娣誨姞鏁板瓧k鏄坊鍔犲湪浜嗘湯灝句竴浣嶏紝浣嗘垜涓寮鏄痙p鏄坊鍔犲湪浜嗛浣嶏紝浣沖摜璇存坊鍔犻浣嶆槸閿欒鐨勶紝浣嗘病鏈夌粰鍑鴻瘉鏄庯紝鎴戞壘鍒頒簡鍙嶄緥錛?1 6錛屽簲璇ユ槸774錛屼絾鎴戜竴寮鏄緱鐨勬槸747錛屼笉榪囦負浠涔堥敊錛屾垜鏃犳硶璇佹槑浜?....
鍦ㄨ幏寰椾笂榪拌漿縐葷姸鎬佸悗錛屾垜浠彲浠ョ敤d鏁扮粍璁板綍鐩稿簲鐘舵佷笅錛屾渶浼樿В鐨勬渶鍚庝竴浣嶏紝榪欐牱鎴戜滑杈撳嚭絳旀灝卞彲浠ヤ粠絎竴浣嶉掑綊瀵繪壘浜嗐?br />鑷充簬鏃犺В鐨勬儏鍐碉紝鍙n>=6閮戒細鏈夎В錛屽洜涓?鏄叚鏍圭伀鏌?.....
鍏朵粬鎬濊礬錛歞p[i][j]璁板綍鏈浼樼瓟妗堬紝榪欐牱浼氭秹鍙婂埌澶ф暟榪愮畻銆?br />浠g爜錛?br />
#include <iostream>
#include 
<cstdio>
#include 
<cstring>
using namespace std;

const int maxn = 101;
const int maxm = 3001;
const int used[10= {6255456376};

typedef 
long long LL;

LL f[maxn][maxm], g[maxn][maxm];
LL n, m, i, j, k, u, v, Len, task;

LL max(LL i, LL j)
{
    
if (i > j) return i;
    
return j;
}

void printf(LL x, LL y)
{
    LL u, v;
    
while (g[x][y] != 10)
    {
        u 
= x + used[g[x][y]];
        v 
= (y * 10 + g[x][y]) % m;
        cout 
<< g[x][y];
        x 
= u;
        y 
= v;
    }
    cout 
<< endl;
}

int main()
{
    task 
= 0;
    
while (cin >> n && n)
    {
        cin 
>> m;
        printf(
"Case %d: "++task);
        memset(f, 
-1sizeof(f));
        Len 
= 0;
        f[
0][0= 0;
        
for (i = 0; i <= n; ++i)
        {
            
for (j = 0; j <= m - 1++j)
            {
                
if (f[i][j] >= 0)
                {
                    
for (k = 0; k <= 9++k)
                    {
                        
if (i + used[k] <= n)
                        {
                            
if (i == 0 && k == 0continue;
                            u 
= i + used[k];
                            v 
= (j * 10 + k) % m;
                            f[u][v] 
= max(f[u][v], f[i][j] + 1);
                            
if (v == 0) Len = max(Len, f[u][v]);
                        }
                    }
                }
            }
        }
        memset(g, 
-1sizeof(g));
        
for (i = n; i >= 0--i)
        {
            
for (j = 0; j <= m - 1++j)
            {
                
if (f[i][j] >= 0)
                {
                    
if (f[i][j] == Len && j == 0)
                    {
                        g[i][j] 
= 10;
                        
continue;
                    }
                    
for (k = 9; k >= 0--k)
                    {
                        
if (i + used[k] <= n)
                        {
                            u 
= i + used[k];
                            v 
= (j * 10 + k) % m;
                            
if (f[u][v] == f[i][j] + 1 && g[u][v] >= 0)
                            {
                                g[i][j] 
= k;
                                
break;
                            }
                        }
                    }
                }
            }
        }
        
if (g[0][0> 0 && g[0][0!= 10) printf(00);
        
else
        
if (n >= 6) cout << 0 << endl;
        
else
        cout 
<< -1 << endl;
    }
    
return 0;
}


LLawliet 2011-10-15 22:14 鍙戣〃璇勮
]]>
HDU3022:Sum of Digitshttp://www.shnenglu.com/lvlawliet/articles/158389.htmlLLawlietLLawlietSat, 15 Oct 2011 14:13:00 GMThttp://www.shnenglu.com/lvlawliet/articles/158389.htmlhttp://www.shnenglu.com/lvlawliet/comments/158389.htmlhttp://www.shnenglu.com/lvlawliet/articles/158389.html#Feedback0http://www.shnenglu.com/lvlawliet/comments/commentRss/158389.htmlhttp://www.shnenglu.com/lvlawliet/services/trackbacks/158389.html

Sum of Digits

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 149    Accepted Submission(s): 46


Problem Description
Petka thought of a positive integer n and reported to Chapayev the sum of its digits and the sum of its squared digits. Chapayev scratched his head and said: "Well, Petka, I won't find just your number, but I can find the smallest fitting number." Can you do the same?
 

Input
The first line contains the number of test cases t (no more than 10000). In each of the following t lines there are numbers s1 and s2 (1 ≤ s1, s2 ≤ 10000) separated by a space. They are the sum of digits and the sum of squared digits of the number n.
 

Output
For each test case, output in a separate line the smallest fitting number n, or "No solution" if there is no such number or if it contains more than 100 digits.
 

Sample Input
4 9 81 12 9 6 10 7 9
 

Sample Output
9 No solution 1122 111112
 

Source
 

Recommend
gaojie
 

鏍規嵁output鐨勬彁紺猴紝緇撴灉涓嶅彲鑳藉ぇ浜?00浣嶏紝鎴戜滑鍙互鐚滃嚭錛宻1鏈澶у氨鏄?00錛宻2鏈澶ф槸8100錛屾墍浠ワ紝瀹屽叏鍙互(s1 * s2)鐨勫鏉傚害銆?/span>
dp[i][j] = min(dp[i - k][j - k * k] + 1, dp[i][j])錛屽叾涓璱琛ㄧず鍜岋紝j琛ㄧず騫蟲柟鍜屾槸錛宬琛ㄧず澶氬嚭鏈楂樹綅鏄痥錛宒p鏁扮粍璁板綍浣嶆暟錛屽悓鏃跺紑涓涓猟鏁扮粍璁板綍鍙鏂規鐨勯浣嶃?br />
鏍規嵁璐績鎬濇兂錛岃緇撴灉鏈灝忥紝鎵浠ュ厛灝介噺姹傚嚭鏈灝忕殑浣嶆暟錛屼箣鍚庢牴鎹綅鏁版瀯閫犳渶灝忕殑鏁般傚緱鍑烘渶灝忎綅鏁板悗錛屽彲浠ラ掑綊姹傚嚭絳旀錛坉鏁扮粍璁板綍鐨勬槸鍙鏂規鐨勯浣嶏紝鎵浠ラ掑綊寰堝ソ瀹炵幇銆傦級

浠g爜錛?br />
#include <iostream>
#include 
<cstdio>
#include 
<cstring>
#include 
<cmath>
using namespace std;

int dp[901][8101], d[901][8101];
int T, n, m;

int main()
{
    memset(dp, 
0sizeof(dp));
    
for (int i = 1; i <= 9++i)
    {
        dp[i][i 
* i] = 1;
        d[i][i 
* i] = i;
    }
    
for (int i = 1; i <= 900++i)
    {
        
for (int j = i; j <= 8100++j)
        {
            
for (int k = 1; k <= 9++k)
            {
                
if (i < k || j < k * k) break;
                
if (dp[i - k][j - k * k] == 0 || dp[i - k][j - k * k] == 100continue;
                
if (dp[i][j] == 0 || dp[i - k][j - k * k] + 1 < dp[i][j])
                {
                    dp[i][j] 
= dp[i - k][j - k * k] + 1;
                    d[i][j] 
= k;
                }
            }
        }
    }
    scanf(
"%d"&T);
    
while (T--)
    {
        scanf(
"%d%d"&n, &m);
        
if (n > 900 || m > 8100 || dp[n][m] == 0)
        {
            printf(
"No solution\n");
            
continue;
        }
        
while (dp[n][m])
        {
            
int dig = d[n][m];
            printf(
"%d", dig);
            n 
-= dig;
            m 
-= dig * dig;
        }
        printf(
"\n");
    }
    
return 0;
}


LLawliet 2011-10-15 22:13 鍙戣〃璇勮
]]>
久久99精品九九九久久婷婷| 理论片午午伦夜理片久久 | 久久久婷婷五月亚洲97号色| 日本三级久久网| 99久久精品国产毛片| 日本免费久久久久久久网站| 久久久免费精品re6| 亚洲精品无码久久久久去q| 久久精品国产亚洲7777| 精品久久久久国产免费 | a级成人毛片久久| 久久精品中文字幕无码绿巨人 | 久久99国产精品久久99小说| 久久99国产精品成人欧美| 99久久精品久久久久久清纯| 国产成人久久777777| 欧美激情精品久久久久| 久久av高潮av无码av喷吹| 午夜视频久久久久一区| 中文字幕无码精品亚洲资源网久久| 国产精品久久久久蜜芽| 午夜天堂av天堂久久久| 久久久久亚洲AV无码专区体验| 久久精品国产亚洲沈樵| 久久综合九色综合久99| 51久久夜色精品国产| 日本欧美国产精品第一页久久| 日产精品久久久一区二区| 久久夜色tv网站| 久久AV无码精品人妻糸列| 精品国产91久久久久久久| 久久久久香蕉视频| 国产精品禁18久久久夂久| 久久精品国产亚洲一区二区三区| 久久综合亚洲色HEZYO社区| 狠狠色丁香久久综合婷婷| 亚洲va久久久久| 国产成人无码精品久久久免费| 国内精品九九久久精品| 久久精品一区二区三区不卡| 久久久久人妻精品一区三寸蜜桃|