02ACM课件(lecture_02)老少皆宜数学题

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

4
Fra Baidu bibliotek胃羹(2)

再来几个: 整数 正的 (adj)负的; (n)负数 (n)阶乘;(adj)因子的,阶乘的 (n)数字;(adj)数字的
1、integer 2、positive 3、negative 4、factorial 5、digital
2013-8-6
5
ACM数学题特点分析:


题意容易理解 算法相对简单(有些很难的!!) 编程比较容易 ACM/ICPC入门练习的好选择
ACM程序设计
第二讲
老少皆宜之数学题
2013-8-6
2
今天,

了吗?
2013-8-6
3
开胃羹(1)
几个常用单词: 1、vertex ( vertices ) 顶点 2、polygon 多边形 3、convex 凸的 4、concave 凹的 5、segment (线)段(n);分割(v)

2013-8-6
2013-8-6 39
回到正题——大锤搞定
2013-8-6
40
1005: Number Sequence
2013-8-6
41


Problem Description
A number sequence is defined as follows:
2013-8-6 19
Output

Print the total time on a single line for each test case.
2013-8-6
20



Sample Input 12 3231 0
Sample Output 17 41
21
2013-8-6
Output Print the word "yes" if 3 divide evenly into F(n). Print the word "no" if not.

2013-8-6
36



Sample Input 0 1 2 3 4 5



Sample Output no no yes no no no
2013-8-6
37
题目分析:

能被3整除的整数的特点? 如果两个数的和能被3整除,这两个数有什么 特点?


关于能否被3整除,这两个数一共有多少种组 合?
2013-8-6
38
Hdoj_1021程序清单:



#include<stdio.h> int main() { long n; while(scanf("%ld",&n) != EOF) if (n%8==2 || n%8==6) printf("yes\n"); else printf("no\n"); return 0; }
2013-8-6
28



Sample Input 53 72 43 52 20 3 25 18 24 15 15 10 -1 -1
Sample Output 13.333 31.500
2013-8-6
29
题目特点:
这个题目比前面两个题目稍难,但是属 于能一眼看出解决办法的题目。只要静 下心,还是比较容易解决的。
2013-8-6 26
Input

The input consists of multiple test cases. Each test case begins with a line containing two non-negative integers M and N. Then N lines follow, each contains two non-negative integers J[i] and F[i] respectively. The last test case is followed by two -1's. All integers are not greater than 1000.
2013-8-6
11
Input

Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters. A test case with N = 0 terminates the input and this test case is not to be processed.

2013-8-6 12
Output

For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.
For a given request list, you are to compute the total time spent to fulfill the requests on the list. The elevator is on the 0th floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.
2013-8-6
17
Problem Description

The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop.
25
Problem Description

FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for all the JavaBeans in the room, instead, he may get J[i]* a% pounds of JavaBeans if he pays F[i]* a% pounds of cat food. Here a is a real number. Now he is assigning this homework to you: tell him the maximum amount of JavaBeans he can obtain.
2013-8-6
13



Sample Input 5 green red blue red red 3 pink orange pink 0

Sample Output red pink
2013-8-6
14
题目评述:
1. 一个让你看到后兴奋的题目…
34
Problem Description


There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).
2013-8-6
35

Input Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000).
2013-8-6
30
1009算法分析:


输入(J , F 放入数组) 对数组排序(按效益,降序) 输出(按效益高低有序交易)
2013-8-6
31
第三类
技巧型
2013-8-6 32
小锤抠缝——
先来看一个简单的题目铺垫一下:
2013-8-6
33
1021 Fibonacci Again
2013-8-6
27
2013-8-6
Output

For each test case, print in a single line a real number accurate up to 3 decimal places, which is the maximum amount of JavaBeans that FatMouse can obtain
下面,分类介绍:
2013-8-6
6
从首届“舜宇”杯说起
2013-8-6
7
比赛背景
由于前一年的邀请赛很多学校没有做出一道 题,所以,这次的比赛特意准备了几道简单 的题目,目的就是让大多数的学校都能拿个 气球回去,也好有个交待,于是有…
2013-8-6
8
第一类
傻瓜型
2013-8-6 9
1004: Let the Balloon Rise
题目评述:
实际上,这是本次比赛最简单的一题,浙大、 浙工大等当时训练水平相对较高的学校基本上 10分钟之内解决该题,这也是一个没有算法的 题目。
这种题目大家不会错过的…
2013-8-6
22
不要分析 了吧…
第二类
基本型
2013-8-6 24
1009: FatMouse' Trade
2013-8-6
2013-8-6 18
Input

There are multiple test cases. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100. A test case with N = 0 denotes the end of input. This test case is not to be processed.
2013-8-6
10
Problem Description

Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result. This year, they decide to leave this lovely job to you.
2. 只要懂点C或者C++,就可解决该问题。
2013-8-6
15
1004题目分析:


该题算法思想比较简单,就是对输入的字符 串进行比较和统计。值得注意的一点是: 如果用C语言来写,要注意可能会把第一个数 字后的“回车符”误认为是第一个串,字符 串的比较也要用函数和循环语句。
2013-8-6
16
1008: Elevator
相关文档
最新文档