all the answers are understandable.
1. Newspaper pages X Planet Daily is the same as our Earth's City Morning Post,
are just a few separate sheets of paper stacked together. Each piece of paper is printed with 4 editions.
For example, a newspaper contains 4 pages: 5,6,11,12,
Make sure it's the top 2nd newspaper.
We picked up a paper on planet X in Space, and 4 pages were:
1125,1126,1727,1728
Please calculate the total number of pages in this newspaper (that is, the largest page number, not the use of a few pieces of paper OH).
Please fill in the number that represents the total page.
Note: You should submit an integer, do not fill in any superfluous content or descriptive text.
/************************************************************************/
/* Newspaper pages * After the use case question data was measured, it was submitted
* *
/************************************************************************/
#include <stdio.h >
int Main ()
{
int A, B, C, D;
scanf ("%d%d%d%d", &a, &b, &c, &d);
Above * Zhang * Zhang total * page
printf ("%d%d%d%d\n", (c-b)/4, B/2, (c-b)/4 + B/2, ((c-b)/4 + B/2) *4);
return 0;
}
2. Number of briquettes
There is a heap of coal, which is made into a triangular pyramid. Specific:
1 on the first floor,
The second layer is 3 (arranged into triangles),
The third layer is 6 (arranged into triangles),
Fourth floor 10 (arranged into triangles),
....
If there is a total of 100 layers, how many coals are there?
Please fill in the number of the total number of coals.
Note: You should submit an integer, do not fill in any superfluous content or descriptive text.
/************************************************************************/
* * Number of briquettes * just started to imagine how it was placed, But the egg, think not come out, finally directly using a formula
* * *
/************************************************************************/
Include <stdio.h>
int main ()
{
int i,n,sum;
sum = 0;
n = 0;
for (i = 1; I <= ++i)
{
n +=i;
sum = n;
printf ("%d\n", n);
}
printf ("%d\n", sum);
return 0;
}
3. Square Cycle
If each digit of a positive integer is squared and then summed, a new positive integer is obtained.
Do the same with the newly generated positive integers.
In this way, you will find that no matter what number you start to take,
Eventually, if you don't fall into 1, you fall into the same circle.
Please write out the largest number in the circle.
Please fill in the maximum number.
Note: You should submit an integer, do not fill in any superfluous content or descriptive text.
/************************************************************************//
* Square Circle
* I randomly lost a number, Run out of 100 results, very obvious loops ...
* *
/************************************************************************/
#include <stdio.h >
int Main ()
{
int i,j,n,sum;
scanf ("%d", &n);
for (i = 1; i < 100;i++)
{
sum = 0;
while (n)
{
j = n%;
sum + + j*j;
n/=;
n = sum;
printf ("%d\n", sum);
}
return 0;
}
4 and 5 skip over
6.15 points
Arithmetic
B DEF
A +---+-------= 10
C GHI
(See figure 1.jpg If you have a problem with the display)
In this formula, A~i represents the number of 1~9, and different letters represent different numbers.
Like what:
6+8/3+952/714 is a solution,
5+3/1+972/486 is another solution.
How many solutions are there in this formula?
Note: You submit should be an integer, do not fill in any superfluous content or descriptive text.
/************************************************************************/
* * * * * * * search + pruning * *
/************************************************************************/
#include <stdio.h>
int a[10], B, c, sum = 0;
BOOL ISVISIT[10];
void dfs (int num)
{
if (10==num)
{
b = a[2] * (a[7] * + a[8] * + a[9]); Tong
c = a[3] * (a[4] * + a[5] * + a[6]);
if (0== (b + c)% (a[3] * (a[7] * + a[8] * + a[9)) //Determine if the addition of two numbers is an integer
{
if (10==a[1) + (b + c)/(A[3) * (a[7] * + a[8] * + a[9])//Judge whether the sum of three numbers is
sum++;
}
for (int i = 1; i < i++)
{
if (isvisit[i] = = 0)
{
isvisit[i] = 1;
A[num] = i;
DFS (num + 1);
Isvisit[i] = 0;
}
}} int main ()
{
DFS (1);
printf ("%d\n", sum);
return 0;
}
7.19 points
Winter Homework
The math problem in elementary school is not so fun now.
Look at this winter vacation homework:
-+-=-
---=-
-x-=-
-÷-=-
(See figure 1.jpg if it doesn't appear)
Each square represents a number in the 1~13, but cannot be repeated.
Like what:
6 + 7 = 13
9-8 = 1 3 * 4 = 12
10/2 = 5
And:
7 + 6 = 13
9-8 = 1
3 * 4 = 12
10/2 = 5
Even two solutions. (addition, multiplication Exchange law after a different scheme)
How many options have you found altogether?
Please fill in an integer representing the number of scenarios.
Note: You should submit an integer, do not fill in any superfluous content or descriptive text.
/************************************************************************/* * * * * * * * * * * search + pruning//*********************
/#include <stdio.h> int a[14], B, c, sum = 0;
BOOL ISVISIT[14];
BOOL Test (int next) {if (3 = next) {if (a[1] + a[2]!= a[3]) {return false;
} if (6 = next) {if (A[4]-a[5]!= a[6]) {return false;
} if (9 = next) {if (a[7] * a[8]!= a[9]) {return false;
} if (= = next) {if (a[10]/a[11]!= a[12] | | a[10]% a[11]!= 0) {return false;
} return true; void dfs (int num) {if (a[3] = a[1] + a[2]) && (a[6] = = a[4]-a[5]) && (a[9) = =
A[7] * a[8]) && (a[12] = = a[10]/a[11)) {sum++;
for (int i = 1; I <= i++) {if (isvisit[i) = = 0) {Isvisit[i] = 1;
A[num] = i;
if (!test (num)) {isvisit[i] = 0;
Continue
DFS (num + 1);
Isvisit[i] = 0;
}
}int main () {DFS (1);
printf ("%d\n", sum);
return 0; }
8.21 points
Hail number
Any given a positive integer n,
If an even number, execute: N/2
If it is odd, execute: N * 3 + 1
The resulting new number performs the same action and repeats itself.
By observation, this number will rise to very high in a moment,
And then landed down again.
That's how it goes up and down, but in the end it's going to be 1.
It's kind of like a small hail particle rolling in a hail cloud.
Like n=9.
9,28,14,7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1
As you can see, when n=9, this "little hail" went up to the height of 52.
Input format:
A positive integer N (n<1000000)
Output format:
A positive integer that represents a number that is not greater than n, and how much of the maximum has been flushed through the process of hail number conversion.
For example, enter:
10
The program should output:
52
Again, for example, enter:
100
The program should output:
9232
/************************************************************************//*
Hail number
* * * */
/******** /
#include <stdio.h>
int ans[ 1000000],i,t_max;
int next (int num)
{
t_max = num;
while (1!= num)
{while
(0 = = num% 2)
{
num/= 2;
}
if (1==num)
{break
;
}
num = num * 3 + 1;
if (Num>t_max)
{
t_max = num;
}
}
return t_max;
}
void OffLine ()
{for
(i = 2; i < 500000; i++)
{
Ans[i] = next (i);
if (Ans[i] < ans[i-1])
{
ans[i] = ans[i-1];
}
printf ("%d %d\n", I, Ans[i]);
}
int main ()
{
int n;
OffLine ();
scanf ("%d", &n);
printf ("%d\n", Ans[n]);
return 0;
}
PS since the work, almost no personal time, this blog has not been updated for six months. I think I have to learn new knowledge every day. (No. 28th, Peking University final, also counted as free travel)