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. struts2响应AJAX

    1发送ajax请求使用stream进行响应 Result的type属性的stream取值. 1.1定义Action public class UserAction { private String u ...

  2. 晨跑(bzoj 1877)

    Description Elaxia最近迷恋上了空手道,他为自己设定了一套健身计划,比如俯卧撑.仰卧起坐等 等,不过到目前为止,他坚持下来的只有晨跑. 现在给出一张学校附近的地图,这张地图中包含N个十 ...

  3. VB 笔记

    阅读方法:网页放大至200%,调整合适位置,阅读很方便,                                                                 csdn就可以 ...

  4. CLR via C#(11)-无参属性、有参数属性(索引器)

    一. 无参属性 1. 定义属性 无参属性就是我们最常见的属性方式,在赋值时可以加入一定的逻辑判断.属性的定义其实不复杂,先看个直观的例子: 说明: 属性要定义名称和类型,且类型不能是void. 属性是 ...

  5. CLR via C#(03)- 对象创建和类型转换

    一. 创建对象 CLR要求用new操作符创建对象,这个操作符在编译时产生的IL指令为newobj.例如: Student XiaoJing=new Student(“XiaoJing”,”1986”) ...

  6. 与你相遇好幸运,Sail.js定义其他主键

    uuid : { type: 'string', unique: true, required: true, primaryKey: true },

  7. android:installLocation = "auto" 的用法

    在Froyo(android 2.2,API Level:8)中引入了android:installLocation.通过设置该属性可以使得开发者以及用户决定程序的安装位置. android:inst ...

  8. 在ubuntu上搭建开发环境4---ubuntu简单的搭建LAMP环境和配置

    最近重新安装了Ubuntu,但是之前的LAMP环境自然也就没有了,实在是不想再去编译搭建LAMP环境(这种方法实在是太费时间,而且太容易遇到各种不知道为什么的错误),所以,就去查查有没有什么简单的搭建 ...

  9. tomcat安装服务和内存参数设置

    第一:安装服务 在dos窗口进入到tomcat的bin目录下,通过如下命令即可将tomcat安装成服务 service.bat install Tomcat2 其中Tomcat2是服务的名称 如果启动 ...

  10. Beego框架使用

    go get github.com/astaxie/beego vim hello.go package main import "github.com/astaxie/beego" ...