Experimental Educational Round: VolBIT Formulas Blitz(展示你的数学思维)

A. Again Twenty Five!

题目描述

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 55 to the power of n and get last two digits of the number. Yes, of course, n can 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?

输入格式

The only line of the input contains a single integer n ( 2<=n<=2⋅10e18 ) — the power in which you need to raise number 55 .

输出格式

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

输入输出样例

输入 

2

输出 

25

说明:

数据很弱直接cout

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

int main(){
    cout<<25<<endl;
    return 0;
}

B. Moore's Law

题目描述

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 2424 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.0000000111.000000011 times.

输入格式

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 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−610−6 .

题意翻译

你养了一只史莱姆,这只史莱姆每秒膨胀1.000000011倍。现在给出史莱姆的初始体积n和时间t,求t秒后史莱姆有多大(1000<=n<=10000,0<=t<=2*109109),答案精确到小数点后6位

输入输出样例

输入 

1000 1000000

输出 #

1011.060722383550382782399454922040

这个就是1.000000011的t次方,然后乘n,难点在于保留小数上面,用printf即可

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	int a,b;
	cin >> a>>b;
	printf("%.40lf" ,double(pow(1.000000011, b) * a));
	return 0;
}

C. Lucky Numbers

题目描述

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 77 and 88 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.

输入格式

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 one integer — the maximum number of offices, than can have unique lucky numbers not longer than n digits.

题意翻译

给定数字位数,即这个数的位数要小于或者等于它,且这个数字只能由7和8组成,问有多少种情况。

输入输出样例

输入 #

2

输出 

6

可能因为数据范围过于弱,暴力循环就过掉了

#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
int main()
{
	int a;
	cin >> a;
	ll ans = 0;
	for (int i = 1; i <= a; i++)
	{
		ans += pow(2, i);
	}
	cout << ans << endl;
	return 0;
}

D. Hexagons!

题目描述

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.

输入格式

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

输出格式

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

题意翻译

在下图六边形网格当中,求离中间六边形距离不超过n的六边形的个数. 

输入输出样例

输入 #1复制

2

输出 #1复制

19

这个题就是一个等差数列,直接运用求和公式秒了

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int main(){
    ll n;
    cin >> n;
    ll ans=1;
    if(n==0) cout<<ans<<endl;
    else{
        ll a=6,b=n*6;
        ll t=(a+b)*n/2;
        cout<<t+1<<endl;
    }
  return 0;
}

E. A rectangle

题目描述

Developing tools for creation of locations maps for turn-based fights in a new game, Petya faced the following problem.

A field map consists of hexagonal cells. Since locations sizes are going to be big, a game designer wants to have a tool for quick filling of a field part with identical enemy units. This action will look like following: a game designer will select a rectangular area on the map, and each cell whose center belongs to the selected rectangle will be filled with the enemy unit.

More formally, if a game designer selected cells having coordinates (�1,�1)(x1​,y1​) and (�2,�2)(x2​,y2​) , where �1<=�2x1​<=x2​ and �1<=�2y1​<=y2​ , then all cells having center coordinates (�,�)(x,y) such that �1<=�<=�2x1​<=x<=x2​ and �1<=�<=�2y1​<=y<=y2​ will be filled. Orthogonal coordinates system is set up so that one of cell sides is parallel to ��OX axis, all hexagon centers have integer coordinates and for each integer �x there are cells having center with such �x coordinate and for each integer �y there are cells having center with such �y coordinate. It is guaranteed that difference �2−�1x2​−x1​ is divisible by 22 .

Working on the problem Petya decided that before painting selected units he wants to output number of units that will be painted on the map.

Help him implement counting of these units before painting.

输入格式

The only line of input contains four integers �1,�1,�2,�2x1​,y1​,x2​,y2​ ( −109<=�1<=�2<=109,−109<=�1<=�2<=109−109<=x1​<=x2​<=109,−109<=y1​<=y2​<=109 ) — the coordinates of the centers of two cells.

输出格式

Output one integer — the number of cells to be filled.

题意翻译

设置一个平面直角坐标系,选择两个点 (x1​,y1​),(x2​,y2​) 建立一个矩阵,其中 x1​≤x2​,y1​≤y2​ ,用中心坐标 (x,y) 为整数的正六边形填充这个矩阵,其中 x1​≤x≤x2​ ,y1​≤y≤y2​ ,并且对于每个整数 �x ,都有中心具有此类 x 坐标的单元格,对于每个整数 y ,都有中心具有此类 y 坐标的单元格。保证 ​−x1​ 可以被 2 整除。

问:能填充多少个正六边形。

输入格式

唯一的输入行包含四个整数 x1​,x2​,y1​,y2​ (−109≤x1​≤x2​≤109,−109≤y1​≤y2​≤109) —— 表示矩阵左下角和右上角的坐标。

输出格式

输出一个整数 —— 要填充的正六边形数。

输入输出样例

输入 #1复制

1 1 5 5

输出 #1复制

13

这题1900分的题,但是毕竟是数学,必有奇特的方法,直接上代码

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long n = (((x2-x1+1)/2) + 1) * ((y2-y1+1)+1)/2 ;
    long long m = ((x2-x1+1)/2) * (((y2-y1+1)+1)/2-1);
    cout << m + n <<endl;
    return 0;
}

F. Selection of Personnel

题目描述

One company of IT City decided to create a group of innovative developments consisting from 55 to 77 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.

输入格式

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

输出格式

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

题意翻译

你所在的公司想要组建一个由5-7人构成的全新团队。于是高层发出了招聘信息,并有n人应聘。

公司的高层要求你告诉他们,在这n个人中任意挑选组成一个团队的方案数。

输入一行一个数字n(7<=n<=777).

输出一行一个数字ans表示方案数,不需要取模。

输入输出样例

输入 

7

输出 

29

高中的排列组合

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long ll;

const int N = 2010, mod = 1e9 + 7;
ll c[N][N];
//组合的模板
void zhs()
{
    for(int i = 0 ; i < N ; i ++)
        for(int j = 0 ; j <= i; j ++)
            if(j == 0) c[i][j] = 1;
            else
                c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]);
}

int main()
{
    zhs();
    int n;
    cin >> n;
    ll a = c[n][5];
    ll b = c[n][6];
    ll d = c[n][7];
    cout << a + b + d;
}


G. Challenge Pennants

题目描述

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 55 "I fixed a critical bug" pennants and 33 "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.

输入格式

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

输出格式

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

题意翻译

题目描述

你有3面相同的蓝旗和5面相同的红旗,这里有n张不同的桌子

问将这8面旗放在这n张桌子上有多少种方法

要求:旗必须放完,每张桌子可容纳无数张旗

注意:当所有的旗分配完后,在某一张桌子上红旗,蓝旗,红旗与红旗,红旗,蓝旗这样类似的不记为不同种

输入

一个n(1<=n<=500)

输出

一个整数表示答案

输入输出样例

输入样例#1:

2

输出样例#1:

24

输入输出样例

输入 #1复制

2

输出 #1复制

24

这个题有点抽象

  1. “当所有的旗分配完后,在某一张桌子上红旗,蓝旗,红旗与红旗,红旗,蓝旗这样类似的不记为不同种”,也就是旗的顺序对这道题并没有影响。
  2. 一张桌子上可以放红旗和多张蓝旗。
  3. 题中的红旗与蓝旗是互不干扰的。

    对于红旗,桌子有 n 张,红旗有 5 张,可以直接套入公式得到 Cn+4 5​。蓝旗同理,套公式得Cn+2 3​。

    则最终答案为 他俩相乘

  4. #include <iostream>
    #include <cstring>
    #include <algorithm>
    
    using namespace std;
    typedef long long ll;
    
    const int N = 2010, mod = 1e9 + 7;
    ll c[N][N];
    
    void zhs()
    {
        for(int i = 0 ; i < N ; i ++)
            for(int j = 0 ; j <= i; j ++)
                if(j == 0) c[i][j] = 1;
                else
                    c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]);
    }
    int main()
    {
        zhs();
        int n;
    	cin>>n;
    	
    	cout<<c[n + 4][5] * c[n + 2][3]<<endl;
    	return 0;
    }

    H. Benches

  5. 题目描述

    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 �2n2 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.

    输入格式

    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 one integer — the number of ways to place the benches.

    题意翻译

    IT市的城市公园由n条东西向的道路与n条南北向的道路交叉组成。因此有n^2个十字路口。

    市政府出资购买五个长凳。为了使长凳看起来多一些,政府决定把它们们安置在尽可能多的道路上。显然,以下方案满足了这一要求:每个长凳放置在路径交叉处,并且每条道路上不放置超过一条长凳。

    请你帮助公园管理局统计放置长凳的方式

    输入输出样例

    输入 

    5
    

    输出 

    120
    #include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        long long n;
        cin >> n;
        long long ans;
        ans=n*(n-1)*(n-2)*(n-3)*(n-4)/120;
        ans=ans*ans;
        ans=ans*120;
        cout<<ans<<endl;
        return 0;
    }

    I. Parking Lot

  6. 题目描述

    To quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.

    The parking lot before the office consists of one line of (2n−2) parking spaces. Unfortunately the total number of cars is greater than the parking lot capacity. Furthermore even amount of cars of each make is greater than the amount of parking spaces! That's why there are no free spaces on the parking lot ever.

    Looking on the straight line of cars the company CEO thought that parking lot would be more beautiful if it contained exactly n successive cars of the same make. Help the CEO determine the number of ways to fill the parking lot this way.

    输入格式

    The only line of the input contains one integer n ( 3<=n<=30 ) — the amount of successive cars of the same make.

    输出格式

    Output one integer — the number of ways to fill the parking lot by cars of four makes using the described way.

    题意翻译

    停车场共有 2*n-2个停车位。共有 44 种品牌的汽车,每种汽车的数量都远大于停车位的数量。

    该公司首席执行官认为,如果停车场有 恰好 n 个连续汽车的品牌相同,则停车场会更漂亮。

    给定n的值,问有多少的方案使停车场满足条件。

    输入格式:

    一行,包含一个整数 n(3≤n≤30)。

    输出格式:

    输出一个整数,即总方案数。

    输入输出样例

    输入 #1复制

    3
    

    输出 #1复制

    24

    说明/提示

    Let's denote car makes in the following way: A — Aston Martin, B — Bentley, M — Mercedes-Maybach, Z — Zaporozhets. For n=3 there are the following appropriate ways to fill the parking lot: AAAB AAAM AAAZ ABBB AMMM AZZZ BBBA BBBM BBBZ BAAA BMMM BZZZ MMMA MMMB MMMZ MAAA MBBB MZZZ ZZZA ZZZB ZZZM ZAAA ZBBB ZMMM

    Originally it was planned to grant sport cars of Ferrari, Lamborghini, Maserati and Bugatti makes but this idea was renounced because it is impossible to drive these cars having small road clearance on the worn-down roads of IT City.

  7. 组合数学

  8. #include <bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        int n ;
        cin >> n;
        if(n == 1){
            cout << 0;return 0;
        }
        if(n == 2){
            cout << 4 << endl;return 0;
        }
        long long ans = 0;
        ans += 2 * 4 * 3 * pow(4,n - 3);
        ans += 4 * ( n - 3 ) * 3 * 3 * pow(4,n-4);
        cout<<ans<<endl;
        return 0;
    }

    J. Divisibility

  9. 题目描述

    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 22 to 1010 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.

    输入格式

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

    输出格式

    Output one integer showing how many numbers from 11 to �n are divisible by all numbers from 22 to 1010 .

    题意翻译

    给你一个数n,求在[1,n]范围内有几个数能被2到10之间的所有整数整除(n<=10181018)

    输入输出样例

    输入 #1复制

    3000
    

    输出 #1复制

    1
  10. 找到2-10的最小公倍数2520,看有几个2520就是答案
  11. #include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    int main(){
        ll n;
        cin >> n;
        ll t=n/2520;
        cout<<t<<endl;
        return 0;
    }

    K. Indivisibility

  12. 题目描述

    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 22 to 1010 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.

    输入格式

    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 one integer showing how many numbers from 11 to n are not divisible by any number from 2 to 10 .

    题意翻译

    题目描述

    开发电脑游戏的IT City公司,准备改善员工奖励机制。奖励机制是这样的,当游戏的注册用户开始花钱购买产品时,公司会精确的跟踪每笔交易。每次当交易次数不能被2~10之间的任何数字整除时,这个游戏的每个开发者都会得到一个小奖励。

    游戏设计师Petya知道公司即将发布一款由他开发的新游戏。根据他的经验,他预测第一个月将会有n个人购买这个游戏。现在Petya想知道他能够获得多少次奖励?

    输入格式

    一行,一个整数n(1≤n≤10^18),表示购买游戏的人的个数

    输出格式

    一行,表示1~n中不能被2~10中任意一个数整除的数的数量

    输入输出样例

    输入 

    12
    

    输出 #

    2
  13. 容斥原理
  14. 
    #include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    int main()
    {
        ll n, ans = 1;
        cin >> n;   //2, 3, 5, 7
        cout << 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;
        return 0;
    }

    N. Forecast

  15. 题目描述

    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.

    输入格式

    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.

    输出格式

    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−610−6 .

    题意翻译

    现给出一元二次方程一般形式中a,b,c的值,求方程的解(保证方程有两个不相等的实数根,-1000<=a,b,c<=1000)。
    第一行输出较大的根,第二行输出较小的根。

    输入输出样例

    输入 #

    1 30 200
    

    输出 #

    -10.000000000000000
    -20.000000000000000
  16. #include <iostream>
    #include <cstring>
    #include <algorithm>
    #include <cmath>
    using namespace std;
    
    int main(){
        double a,b,c;
        cin>>a>>b>>c;
        double x1=(-b+sqrt(pow(b,2)-4*a*c))/(2*a);
        double x2=(-b-sqrt(pow(b,2)-4*a*c))/(2*a);
        if(x1<x2) printf("%.10lf\n%.10lf",x2,x1);
        else printf("%.10lf\n%.10lf",x1,x2);
    }

    R. Game

  17. 题目描述

    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.

    输入格式

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

    输出格式

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

    题意翻译

    题目描述

    学生与教授在)n×n(1<=n<=1018)的棋盘上做游戏,教授给定n的值,学生可以选择是先手还是后手。规则如下:

    两人轮流给棋盘上的格子染色,不能将已染色的格子的周围格进行染色。这里的周围格指的是有公共边的格子,也就是说仅有公共点的格子是可以染色的。谁没有格子染谁就输。

    问:若两人都以最好的方式染色(也就是尽可能使自己赢),学生应该选择先手还是后手?

    输入格式

    一行一个整数n,表示棋盘的边长。

    输出格式

    一行一个整数1或2,1表示学生应该选择先手,2反之。

    输入输出样例

    输入 #1复制

    1
    

    输出 #1复制

    1

    输入 #2复制

    2
    

    输出 #2复制

    2
  18. 虽然是博弈论,但是自由妙计
  19. #include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    int main(){
        ll n;
        cin >> n;
        if(n%2==0) cout<<2<<endl;
        else cout<<1<<endl;
    }

  • 36
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值