2015蓝桥真题 （B组国赛）:积分之迷
2017-07-12 11:28:43       个评论    来源：zyf_2014的博客
我要投稿

2015蓝桥真题 (B组国赛)

105

-------------------------

3A + 7B + C = 315 ......(1)

4A + 10B + C = 420 ......(2)

(2)-(1) 得：A+3B = 105

(1)式变形： 2(A+3B) + (A+B+C) = 315

2 3 4 6 7 8 12 13 14 15 16 17 18 21 22 23 24 26 27 28 50 60

22阶完美正方形一共有8种。下面的组合是另一种：

2 5 9 11 16 17 19 21 22 24 26 30 31 33 35 36 41 46 47 50 52 61

50 33 30 41

---------------------

#include

#include

using namespace std;

int a[]={2, 5 ,9 ,11 ,16, 17, 19, 21, 22, 24, 26, 30, 31, 33, 35, 36, 41, 50 ,52 };//正方形

int vis[19]; //访问数组

int que[30]; // 存储最下行每个正方形大小

int fon=0; //最下行正方形索引

int map[154][154]; //填充为1 未填充为0

void make(int x,int y,int k,int u) //填充和清除正方形 u为1为填充 否则为清空

{

if(u==1)

for(int i=x;i154)

return 0;

if(y+k>154)

return 0;

//判断将被填入的正方形部分是否有已经被填充部分

for(int i=x;i=19) //完成遍历

{

for(int i=0;i

#include

#define N 100

int connected(int* m, int p, int q)

{

return m[p]==m[q]? 1 : 0;

}

void link(int* m, int p, int q)

{

int i;

if(connected(m,p,q)) return;

int pID = m[p];

int qID = m[q];

for(i=0; i

}

int main()

{

int m[N];

int i;

for(i=0; i

printf("%d ", connected(m,4,7));

printf("%d ", connected(m,4,5));

printf("%d ", connected(m,7,9));

printf("%d ", connected(m,9,2));

return 0;

}

if(m[i]==pID) m[i]=qID

1 1 0 1 0 0

#include

#define N 100

int connected(int* m, int p, int q)

{

return m[p]==m[q]? 1 : 0;

}

void link(int* m, int p, int q)

{

int i;

if(connected(m,p,q)) return;

int pID = m[p];

int qID = m[q];

for(i=0; i

}

void show(int* m)

{

int i;

for(i=0; i<10; i++) printf("%d=%d ", i, m[i]);

printf("\n");

}

int main()

{

int m[N];

int i;

for(i=0; i

printf("%d ", connected(m,4,7));

printf("%d ", connected(m,4,5));

printf("%d ", connected(m,7,9));

printf("%d ", connected(m,11,4));

printf("%d ", connected(m,9,2));

printf("%d ", connected(m,12,5));

printf("\n");

return 0;

}

aaaabbbbaabbcccc

2

aaaabbbb

abcabccc

4

CPU消耗 < 3000ms

1

1

10

hggagghs

sjfssakh

hfhaggfi

sahsfias

sksjsahf

ifgfahhg

sasifhaj

akjfshas

iasihaff

10

faashhig

hhgagggs

sfsaihas

ghghsgga

ghghhsag

ffhaiggh

hhgghsag

shghghaf

ghgfahsh