# The 7th Blue Bridge Cup provincial competition

Posted by ravensshade on Wed, 23 Feb 2022 14:27:05 +0100

# Number of briquettes (violence)

Description

There is a pile of coal balls, piled into a triangular pyramid. Specific:

One on the first floor,

Three on the second layer (arranged in a triangle),

6 on the third layer (arranged in a triangle),

10 on the fourth floor (arranged in a triangle)

If there are 100 floors, how many briquettes are there?

Please fill in the number indicating the total number of briquettes.

Note: what you submit should be an integer. Do not fill in any redundant content or explanatory text.

Input
nothing

Output
Just fill in an integer (fill in the blank without filling in the code), which represents the total number of briquettes.

## code

```#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
long long ans=0;
int k=0;
for(int i=1;i<=100;i++){
k+=i;
ans+=k;
}
cout<<ans;
return 0;
}
```

# Birthday candles (violence)

Description

A gentleman has held a birthday party every year since a certain year, and he has to blow out the same number of candles as his age every time.

Now, he blew out 236 candles.

Excuse me, how old did he start his birthday party?

Please fill in the age of his birthday party.

Note: what you submit should be an integer. Do not fill in any redundant content or explanatory text.

Input
nothing

Output
Output an integer. The age at which the birthday party begins.

26

## code

```#include<bits/stdc++.h>
using namespace std;

int main(){

for(int i=1;i<=236;i++){
for(int j=i;j<=236;j++){
int ans=0;
for(int k=i;k<=j;k++){
ans+=k;
}
if(ans==236){
cout<<i;
return 0;
}
}
}

return 0;
}
```

# Calculation formula (violence)

29

## code

```#include<bits/stdc++.h>
using namespace std;

int a[10];
int main(){

for(int i=1;i<=9;i++) a[i]=i;

int cnt=0;
do{
int A=a[1],B=a[2],C=a[3],D=a[4]*100+a[5]*10+a[6],E=a[7]*100+a[8]*10+a[9];
int x=B*E+C*D,y=(10-A)*C*E;
if(x==y) cnt++;

}while(next_permutation(a+1,a+10));
cout<<cnt;
return 0;
}
```

# Square filling (violence)

Description

The following 10 grids

Fill in numbers from 0 to 9. Requirement: two consecutive numbers cannot be adjacent.

(left, right, up, down and diagonal are adjacent)

How many possible filling schemes are there?

Please fill in an integer representing the number of schemes.

Note: what you submit should be an integer. Do not fill in any redundant content or explanatory text.

Input
nothing

1580

## code

```#include<bits/stdc++.h>
using namespace std;

int a[4][5];
int b[10];
int x[8]={1,0,-1,0,1,1,-1,-1},y[8]={0,1,0,-1,1,-1,1,-1};

bool check(){
for(int i=1;i<=3;i++){
for(int j=1;j<=4;j++){
if(a[i][j]==100) continue;
for(int k=0;k<8;k++){
int xx=i-x[k],yy=j-y[k];
if(xx>0&&yy>0&&xx<=3&&yy<=4){
if(a[xx][yy]==a[i][j]-1) return false;
if(a[xx][yy]==a[i][j]+1) return false;
}
}
}
}
return true;
}
int main(){

for(int i=0;i<=9;i++) b[i]=i;
a[1][1]=100,a[3][4]=100;

int ans=0;
do{
int num=0;
for(int i=1;i<=3;i++){
for(int j=1;j<=4;j++){
if(a[i][j]==100) continue;
a[i][j]=b[num++];
}
}
//cout<<num<<endl;
if(check()){
ans++;
}
}while(next_permutation(b,b+10));
cout<<ans;
return 0;
}
```

# Stamp cutting (DFS)

Description

As shown in Figure 1, there are 12 stamps of the 12 Chinese zodiac animals connected together.

Now you have to cut five of them. They must be connected.

(only one corner is not connected)

For example, in Figure 2 and figure 3, the part shown in pink is qualified cutting.

Please calculate how many different cutting methods there are.

Please fill in an integer representing the number of schemes.

Note: what you submit should be an integer. Do not fill in any redundant content or explanatory text.

Input
nothing

Output
Output an integer. Indicates the number of schemes.

116

## code

```#include<bits/stdc++.h>
using namespace std;

int aa[4][5];
int ba[13];
bool v[13],g[4][5];
int h[4]={0,0,-1,1},l[4]={1,-1,0,0};
int ans;

void dfs(int x,int y){
g[x][y]=true;
if(ans==5) return ;
for(int i=0;i<4;i++){
int xx=x-h[i],yy=y-l[i];
if(v[aa[xx][yy]]&&!g[xx][yy]&&xx>0&&yy>0&&xx<=3&&yy<=4) ans++,dfs(xx,yy);
}
return;
}

int main(){

for(int i=1;i<=12;i++) ba[i]=i;
int num=1;
for(int i=1;i<=3;i++)
for(int j=1;j<=4;j++) aa[i][j]=num++;

int an=0;
for(int a=1;a<13;a++)
for(int b=1;b<13&&a!=b;b++)
for(int c=1;c<13&&c!=a&&c!=b;c++)
for(int d=1;d<13&&d!=a&&d!=b&&d!=c;d++)
for(int e=1;e<13&&e!=a&&e!=b&&e!=c&&e!=d;e++){

memset(v,0,sizeof v);
memset(g,0,sizeof g);
ans=1;

v[a]=v[b]=v[c]=v[d]=v[e]=true;

int x,y;
bool A=0;
for(int i=1;i<=3;i++){
for(int j=1;j<=4;j++){
if(v[aa[i][j]]) x=i,y=j,A=1;
if(A) break;
}
if(A) break;
}

dfs(x,y);
if(ans==5) an++;
}
cout<<an;

return 0;
}
```