cf的一次数学场。。。

递推 C

题意:长度<=n的数只含有7或8的个数

分析:每一位都有2种可能,累加不同长度的方案数就是总方案数

组合 G

题意:将5个苹果和3个梨放进n个不同的盒子里的方案数。

分析:经典的组合题目:C(n+5-1, 5) * C(n+3-1, 3)。因为可以同一个盒子放多个苹果或梨,在n基础上多k-1个,看成每个盒子放一个。

组合 H

题意:将5个车放在n*n的棋盘上的方案数。

分析:也是经典的题目,先选行,再全排列,即C (n, 5) * A (n, 5)。

枚举 I

题意:有4种车和2*n-2个停车位,要求必须连续停n辆同种类的车,问将所有车位停满的方案数。

分析:枚举停n辆同种类车的起点,统计就好了。注意,n俩相邻的方案是3,其余是4。

数学 J

题意:问1-n里面能够被2-10全部整除的数有多少个?

分析:lcm(2, ... 10) = 2520。ans = n / lcm。

数学 K

题意:问1-n里面 能够不被[2, 10]里面任意一个数整除的数 有多少个?

分析:J题的变形,经典的容斥题目。容斥原理

import java.io.*;
import java.util.*; public class Main {
public static void main(String[] args) {
new Main ().run ();
}
void run() {
Scanner cin = new Scanner (new BufferedInputStream (System.in));
long n = cin.nextLong ();
long ans = n - n / 2 - n / 3 - n / 5 - n / 7;
ans = ans + n/(2*3) + n/(2*5) + n/(2*7) + n/(3*5) + n/(3*7) + n/(5*7);
ans = ans - n/(2*3*5) - n/(2*3*7) - n/(2*5*7) - n/(3*5*7);
ans = ans + n / (2 * 3 * 5 * 7);
System.out.println (ans);
}
}

数学 P

题意:问你n角形的面积。

分析:角度已知,只要算出蓝线占直线的比例,就能算出面积。

#include <bits/stdc++.h>

const double PI = acos (-1.0);

int main(void)  {
int n;
double r;
scanf ("%d%lf", &n, &r);
double a = 2 * PI / n;
double ans = 0.5 * n * r * r * sin (a) * sin (a/4) / (cos (a/2) * sin (PI - a*3/4));
printf ("%.10f\n", ans); return 0;
}

  

Experimental Educational Round: VolBIT Formulas Blitz的更多相关文章

  1. Experimental Educational Round: VolBIT Formulas Blitz K

    Description IT City company developing computer games decided to upgrade its way to reward its emplo ...

  2. Experimental Educational Round: VolBIT Formulas Blitz N

    Description The Department of economic development of IT City created a model of city development ti ...

  3. Experimental Educational Round: VolBIT Formulas Blitz J

    Description IT City company developing computer games invented a new way to reward its employees. Af ...

  4. Experimental Educational Round: VolBIT Formulas Blitz F

    Description One company of IT City decided to create a group of innovative developments consisting f ...

  5. Experimental Educational Round: VolBIT Formulas Blitz D

    Description After a probationary period in the game development company of IT City Petya was include ...

  6. Experimental Educational Round: VolBIT Formulas Blitz C

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

  7. Experimental Educational Round: VolBIT Formulas Blitz B

    Description The city administration of IT City decided to fix up a symbol of scientific and technica ...

  8. Experimental Educational Round: VolBIT Formulas Blitz A

    Description The HR manager was disappointed again. The last applicant failed the interview the same ...

  9. Experimental Educational Round: VolBIT Formulas Blitz K. Indivisibility —— 容斥原理

    题目链接:http://codeforces.com/contest/630/problem/K K. Indivisibility time limit per test 0.5 seconds m ...

随机推荐

  1. Qt 添加启动项

    QString application_name = QApplication::applicationName(); QSettings *settings = new QSettings(&quo ...

  2. microsofr visual studio编写c语言

    过程: 1.创建win32 控制台项目 文件->新建->项目->Visual C++ ->Win32   输入项目名称   选择项目保存位置 2.添加->新建如图

  3. 瞧一瞧迷一般的SQLDA

    With static SQL, host variables used in embedded SQL statements are known at application compile tim ...

  4. POJ3321 Apple Tree(树状数组)

    先做一次dfs求得每个节点为根的子树在树状数组中编号的起始值和结束值,再树状数组做区间查询 与单点更新. #include<cstdio> #include<iostream> ...

  5. hdu 4025 2011上海赛区网络赛E 压缩 ***

    直接T了,居然可以这么剪枝 题解链接:点我 #include<cstdio> #include<map> #include<cstring> #define ll ...

  6. Socket编程注意接收缓冲区大小

    转自:http://www.cnblogs.com/ITBread/p/3900254.html 最近在做一个udp升级程序,因文件有点大,需要将程序分成多个包发送,每次发送一个包,收到回复后发送下一 ...

  7. 如何通过阅读C标准来解决C语言语法问题

    有时候必须非常专注地阅读ANSI C标准才能找到某个问题的答案.一位销售工程师把下面这段代码作为测试用例发给Sun的编译小组. foo(const char **p) {} int main(int ...

  8. Python3 基本数据类型注意事项

    Python3 基本数据类型 教程转自菜鸟教程:http://www.runoob.com/python3/python3-data-type.html Python中的变量不需要声明.每个变量在使用 ...

  9. poj 3468【线段树】

    题意:给定Q(1<=Q<=100000)个数A1,A2…AQ,以及可能多次进行的两个操作 1)对某个区间Ai……Aj的每个数都加n(n可变) 2)对某个区间Ai……Aj的数求和 分析: 树 ...

  10. 在ubuntu中安装jdk

    安装环境 操作系统:ubuntu 14.04.1 server amd64 下载jdk wget http://download.oracle.com/otn-pub/java/jdk/7u67-b0 ...