Experimental Educational Round: VolBIT Formulas Blitz 公式题

A. Again Twenty Five!
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, ncan be rather big, and one cannot find the power using a calculator, but we need people who are able to think, not just follow the instructions."

Could you pass the interview in the machine vision company in IT City?

Input

The only line of the input contains a single integer n (2 ≤ n ≤ 2·1018) — the power in which you need to raise number 5.

Output

Output the last two digits of 5n without spaces between them.

Examples
input
2
output
25

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
const LL maxm=1e5+10;
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        printf("25\n");
    }
    return 0;
}</span>

B. Moore's Law
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

The city administration of IT City decided to fix up a symbol of scientific and technical progress in the city's main square, namely an indicator board that shows the effect of Moore's law in real time.

Moore's law is the observation that the number of transistors in a dense integrated circuit doubles approximately every 24 months. The implication of Moore's law is that computer performance as function of time increases exponentially as well.

You are to prepare information that will change every second to display on the indicator board. Let's assume that every second the number of transistors increases exactly 1.000000011 times.

Input

The only line of the input contains a pair of integers n (1000 ≤ n ≤ 10 000) and t (0 ≤ t ≤ 2 000 000 000) — the number of transistors in the initial time and the number of seconds passed since the initial time.

Output

Output one number — the estimate of the number of transistors in a dence integrated circuit in t seconds since the initial time. The relative error of your answer should not be greater than 10 - 6.

Examples
input
1000 1000000
output
1011.060722383550382782399454922040

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
int main()
{
    double n,t;
    while(scanf("%lf%lf",&n,&t)!=EOF)
    {
        double x=pow(1.000000011,t)*n;
        printf("%f\n",x);
    }
    return 0;
}</span>

C. Lucky Numbers
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.

Lucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building of the Tax Office given that a door-plate can hold a number not longer than n digits.

Input

The only line of input contains one integer n (1 ≤ n ≤ 55) — the maximum length of a number that a door-plate can hold.

Output

Output one integer — the maximum number of offices, than can have unique lucky numbers not longer than n digits.

Examples
input
2
output
6

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
const LL maxm=60;
LL dp[maxm];
LL POW(LL n)
{
    LL sum=1;
    for(LL i=1;i<=n;i++)
    {
        sum*=2;
    }
    return sum;
}
void Init()
{
    dp[1]=2;
    for(LL i=2;i<=55;i++)
    {
        dp[i]=dp[i-1]+POW(i);
    }
}
int main()
{
    LL n;
    Init();
    while(scanf("%I64d",&n)!=EOF)
    {
        printf("%I64d\n",dp[n]);
    }
    return 0;
}</span>

D. Hexagons!
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

After a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known "Heroes of Might & Magic". A part of the game is turn-based fights of big squadrons of enemies on infinite fields where every cell is in form of a hexagon.

Some of magic effects are able to affect several field cells at once, cells that are situated not farther than n cells away from the cell in which the effect was applied. The distance between cells is the minimum number of cell border crosses on a path from one cell to another.

It is easy to see that the number of cells affected by a magic effect grows rapidly when n increases, so it can adversely affect the game performance. That's why Petya decided to write a program that can, given n, determine the number of cells that should be repainted after effect application, so that game designers can balance scale of the effects and the game performance. Help him to do it. Find the number of hexagons situated not farther than n cells away from a given cell.

Experimental Educational Round: VolBIT Formulas Blitz 公式题_第1张图片
Input

The only line of the input contains one integer n (0 ≤ n ≤ 109).

Output

Output one integer — the number of hexagons situated not farther than n cells away from a given cell.

Examples
input
2
output

19

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
LL POW(LL n)
{
    LL sum=1;
    for(LL i=1;i<=3;i++)
    {
        sum*=n;
    }
    return sum;
}
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        LL sum=POW(n+1)-POW(n);
        printf("%I64d\n",sum);
    }
    return 0;
}</span>

F. Selection of Personnel
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each possible group composition and select one of them. Your task is to count the number of variants of group composition to evaluate.

Input

The only line of the input contains one integer n (7 ≤ n ≤ 777) — the number of potential employees that sent resumes.

Output

Output one integer — the number of different variants of group composition.

Examples
input
7
output
29

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
LL C(LL m,LL n)
{
    if(n>m)
        return 0;
    LL ans=1;
    for(LL i=1;i<=n;i++)
    {
        ans*=m+1-i;
        ans/=i;
    }
    return ans;
}
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        LL sum=C(n,5)+C(n,6)+C(n,7);
        printf("%I64d\n",sum);
    }
    return 0;
}</span>

G. Challenge Pennants
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

Because of budget cuts one IT company established new non-financial reward system instead of bonuses.

Two kinds of actions are rewarded: fixing critical bugs and suggesting new interesting features. A man who fixed a critical bug gets "I fixed a critical bug" pennant on his table. A man who suggested a new interesting feature gets "I suggested a new feature" pennant on his table.

Because of the limited budget of the new reward system only 5 "I fixed a critical bug" pennants and 3 "I suggested a new feature" pennants were bought.

In order to use these pennants for a long time they were made challenge ones. When a man fixes a new critical bug one of the earlier awarded "I fixed a critical bug" pennants is passed on to his table. When a man suggests a new interesting feature one of the earlier awarded "I suggested a new feature" pennants is passed on to his table.

One man can have several pennants of one type and of course he can have pennants of both types on his table. There are n tables in the IT company. Find the number of ways to place the pennants on these tables given that each pennant is situated on one of the tables and each table is big enough to contain any number of pennants.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 500) — the number of tables in the IT company.

Output

Output one integer — the amount of ways to place the pennants on n tables.

Examples
input
2
output
24

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
LL C(LL m,LL n)
{
    if(n>m)
        return 0;
    LL ans=1;
    for(LL i=1;i<=n;i++)
    {
        ans*=m+1-i;
        ans/=i;
    }
    return ans;
}
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        LL sum=C(n+4,5)*C(n+2,3);
        printf("%I64d\n",sum);
    }
    return 0;
}</span>
H. Benches
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections.

The city funded purchase of five benches. To make it seems that there are many benches it was decided to place them on as many paths as possible. Obviously this requirement is satisfied by the following scheme: each bench is placed on a cross of paths and each path contains not more than one bench.

Help the park administration count the number of ways to place the benches.

Input

The only line of the input contains one integer n (5 ≤ n ≤ 100) — the number of east to west paths and north to south paths.

Output

Output one integer — the number of ways to place the benches.

Examples
input
5
output
120

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
LL A(LL n,LL m)
{
    LL ans=1;
    for(LL i=n;i>=(n-m+1);i--)
    {
        ans*=i;
    }
    return ans;
}
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        LL sum=A(n,5)*(A(n,5)/120);
        printf("%I64d\n",sum);
    }
    return 0;
}</span>
J. Divisibility
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.

A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.

Output

Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.

Examples
input
3000
output
1

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        LL x=n/2520;
        printf("%I64d\n",x);
    }
    return 0;
}</span>


K. Indivisibility
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

IT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is not divisible by any number from 2 to 10 every developer of this game gets a small bonus.

A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.

Output

Output one integer showing how many numbers from 1 to n are not divisible by any number from 2 to 10.

Examples
input
12
output
2

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL __int64
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        n-=(n/2+n/3+n/5+n/7-n/6-n/10-n/14-n/15-n/21-n/35+n/30+n/42+n/70+n/105-n/210);
        printf("%I64d\n",n);
    }
    return 0;
}</span>

L. Cracking the Code
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS activation code arrives.

A young hacker Vasya disassembled the program and found the algorithm that transforms the shown number into the activation code.Note: it is clear that Vasya is a law-abiding hacker, and made it for a noble purpose — to show the developer the imperfection of their protection.

The found algorithm looks the following way. At first the digits of the number are shuffled in the following order <first digit><third digit><fifth digit><fourth digit><second digit>. For example the shuffle of 12345 should lead to 13542. On the second stage the number is raised to the fifth power. The result of the shuffle and exponentiation of the number 12345 is 455 422 043 125 550 171 232. The answer is the 5 last digits of this result. For the number 12345 the answer should be 71232.

Vasya is going to write a keygen program implementing this algorithm. Can you do the same?

Input

The only line of the input contains a positive integer five digit number for which the activation code should be found.

Output

Output exactly 5 digits without spaces between them — the found activation code of the program.

Examples
input
12345
output
71232

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL __int64
string x;
int main()
{
    LL n;
    while(cin>>x)
    {
        n=(x[0]-'0')*10000+(x[1]-'0')+(x[2]-'0')*1000+(x[3]-'0')*10+(x[4]-'0')*100;
        LL ans=1;
        for(LL i=0;i<5;i++)
        {
            ans=ans*n%100000;
        }
        printf("%05I64d\n",ans);
    }
    return 0;
}</span>

M. Turn
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.

One of the project's know-how is a camera rotating around its optical axis on shooting. People see an eye-catching gadget — a rotating camera — come up to it to see it better, look into it. And the camera takes their photo at that time. What could be better for high quality identification?

But not everything is so simple. The pictures from camera appear rotated too (on clockwise camera rotation frame the content becomes rotated counter-clockwise). But the identification algorithm can work only with faces that are just slightly deviated from vertical.

Vasya was entrusted to correct the situation — to rotate a captured image so that image would be minimally deviated from vertical. Requirements were severe. Firstly, the picture should be rotated only on angle divisible by 90 degrees to not lose a bit of information about the image. Secondly, the frames from the camera are so huge and FPS is so big that adequate rotation speed is provided by hardware FPGA solution only. And this solution can rotate only by 90 degrees clockwise. Of course, one can apply 90 degrees turn several times but for the sake of performance the number of turns should be minimized.

Help Vasya implement the program that by the given rotation angle of the camera can determine the minimum number of 90 degrees clockwise turns necessary to get a picture in which up direction deviation from vertical is minimum.

The next figure contains frames taken from an unrotated camera, then from rotated 90 degrees clockwise, then from rotated 90 degrees counter-clockwise. Arrows show direction to "true up".

Experimental Educational Round: VolBIT Formulas Blitz 公式题_第2张图片

The next figure shows 90 degrees clockwise turn by FPGA hardware.

Experimental Educational Round: VolBIT Formulas Blitz 公式题_第3张图片
Input

The only line of the input contains one integer x ( - 1018 ≤ x ≤ 1018) — camera angle in degrees. Positive value denotes clockwise camera rotation, negative — counter-clockwise.

Output

Output one integer — the minimum required number of 90 degrees clockwise turns.

Examples
input
60
output
1
input
-60
output
3
Note

When the camera is rotated 60 degrees counter-clockwise (the second example), an image from it is rotated 60 degrees clockwise. One90 degrees clockwise turn of the image result in 150 degrees clockwise total rotation and deviation from "true up" for one turn is 150degrees. Two 90 degrees clockwise turns of the image result in 240 degrees clockwise total rotation and deviation from "true up" for two turns is 120 degrees because 240 degrees clockwise equal to 120 degrees counter-clockwise. Three 90 degrees clockwise turns of the image result in 330 degrees clockwise total rotation and deviation from "true up" for three turns is 30 degrees because 330 degrees clockwise equal to 30 degrees counter-clockwise.

From 60150120 and 30 degrees deviations the smallest is 30, and it it achieved in three 90 degrees clockwise turns.

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL __int64
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        n=(n%360+360)%360;
        if(n>=315)
            printf("0\n");
        else
            printf("%I64d\n",n/90+(n%90-1)/45);

    }
    return 0;
}</span>


N. Forecast
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

The Department of economic development of IT City created a model of city development till year 2100.

To prepare report about growth perspectives it is required to get growth estimates from the model.

To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots.

The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one.

Input

The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation.

Output

In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6.

Examples
input
1 30 200
output
-10.000000000000000
-20.000000000000000

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
int main()
{
    double a,b,c;
    while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
    {
        double x1=(-b+sqrt(b*b-4*a*c))/(2*a);
        double x2=(-b-sqrt(b*b-4*a*c))/(2*a);
        if(x1>x2)
            printf("%0.6f\n%0.6f\n",x1,x2);
        else
            printf("%0.6f\n%0.6f\n",x2,x1);
    }
    return 0;
}</span>
R. Game
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.

The game is played on a square field consisting of n × n cells. Initially all cells are empty. On each turn a player chooses and paint an empty cell that has no common sides with previously painted cells. Adjacent corner of painted cells is allowed. On the next turn another player does the same, then the first one and so on. The player with no cells to paint on his turn loses.

The professor have chosen the field size n and allowed the student to choose to be the first or the second player in the game. What should the student choose to win the game? Both players play optimally.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the size of the field.

Output

Output number 1, if the player making the first turn wins when both players play optimally, otherwise print number 2.

Examples
input
1
output
1
input
2
output
2

<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
#define LL __int64
int main()
{
    LL n;
    while(scanf("%I64d",&n)!=EOF)
    {
        if(n&1)
        {
            printf("1\n");
        }
        else
        {
            printf("2\n");
        }
    }
    return 0;
}</span>



你可能感兴趣的:(Experimental Educational Round: VolBIT Formulas Blitz 公式题)