The 2015 ACM-ICPC China Shandong Provincial
Programming Contest
Problem Set
May 10, 2015
This problem set should contain twelve (12) problems on fifteen (15) pages.
Please inform a runner immediately if something is missing from your problem set.
Problem A. Nias and Tug-of-War
Description
Nias is fond of tug-of-war. One day, he organized a tug-of-war game and invited a group of friends to take part in.
Nias will divide them into two groups. The strategy is simple, sorting them into a row according to their height from short to tall, then let them say one and two alternately (i.e. one, two, one, two...). The people who say one are the members of the red team while others are the members of the blue team.
We know that the team which has a larger sum of weight has advantages in the tug-of-war. Now give you the guys' heights and weights, please tell us which team has advantages.
Input
The first line of input contains an integer T, indicating the number of test cases.
The first line of each test case contains an integer N (N is even and 6 ≤ N ≤ 100).
Each of the next N lines contains two real numbers X and Y, representing the height and weight of a friend respectively.
Output
One line for each test case. If the red team is more likely to win, output "red", if the blue team is more likely to win, output "blue". If both teams have the same weight, output "fair".
Sample Input
1
6
170 55
165.3 52.5
180.2 60.3
173.3 62.3
175 57
162.2 50
Sample Output
blue
Problem B. Lowest Unique Price
Description
Recently my buddies and I came across an idea! We want to build a website to sell things in a new way.
For each product, everyone could bid at a price, or cancel his previous bid, finally we sale the product to the one who offered the "lowest unique price". The lowest unique price is defined to be the lowest price that was called only once.
So we need a program to find the "lowest unique price", We'd like to write a program to process the customers' bids and answer the query of what's the current lowest unique price.
All what we need now is merely a programmer. We will give you an "Accepted" as long as you help us to write the program.
Input
The first line of input contains an integer T, indicating the number of test cases (T ≤ 60).
Each test case begins with a integer N (1 ≤N ≤200000) indicating the number of operations.
Next N lines each represents an operation.
There are three kinds of operations:
"b x": x (1 ≤ x ≤ 106) is an integer, this means a customer bids at price x.
"c x": a customer has canceled his bid at price x.
"q" : means "Query". You should print the current lowest unique price.
Our customers are honest, they won't cancel the price they didn't bid at.
Output
Please print the current lowest unique price for every query ("q"). Print "none" (without quotes) if there is no lowest unique price.
Sample Input
2
3
b 2
b 2
q
12
b 2
b 2
b 3
b 3
q
b 4
q
c 4
c 3
q
c 2
q
Sample Output none
none
4
3
2
Problem C. Game!
Description
One day, zbybr is playing a game with blankcqk, here are the rules of the game:
There is a circle of N stones, zbybr and blankcqk take turns taking the stones.
Each time, one player can choose to take one stone or take two adjacent stones.
You should notice that if there are 4 stones, and zbybr takes the 2nd, the 1st and 3rd stones are still not adjacent.
The winner is the one who takes the last stone.
Now, the game begins and zbybr moves first.
If both of them will play with the best strategy, can you tell me who will win the game?
Input
The first line of input contains an integer T, indicating the number of test cases (T≈100000).
For each case, there is a positive integer N (N ≤ 1018).
Output
Output the name of the winner.
Sample Input
2
1
2
Sample Output
zbybr
zbybr
Problem D. Stars
Description
There are N (1 ≤ N ≤ 400) stars in the sky. And each of them has a unique coordinate (x, y) (1 ≤ x, y ≤ N). Please calculate the minimum area of the rectangle (the edges of the rectangle must be parallel to the X, Y axes) that can cover at least K (1 ≤ K ≤ N) stars. The stars on the borders of the rectangle should not be counted, and the length of each rectangle’s edge should be an integer.
Input
Input may contain several test cases. The first line is a positive integer T (T ≤10), indicating the number of test cases below.
For each test cases, the first line contains two integers N, K, indicating the total number of the stars and the number of stars the rectangle should cover at least.
Each of the following N lines contains two integers x, y, indicating the coordinate of the stars.
Output
For each test case, output the answer on a single line.
Sample Input
2
1 1
1 1
2 2
1 1
1 2
Sample Output
1
2
Description
BIGZHUGOD and his three friends feel bored at home, then they decide to play a game called "niuniu".
The rules of "niuniu" are: first randomly pick 5 cards from all cards, then divide them into 2 groups, one group has 2 cards, and the other has 3 cards. If the sum of both groups are multiples of 10, then they are "niuniu". Moreover, A counts for 1, J, Q, K, black joker and red joker counts for 10.
BIGZHUGOD has an incomplete pack of card. And his three friends let BIGZHUGOD pick up 5 cards randomly, if they are "niuniu", BIGZHUGOD will gain meals from friends.
Now BIGZHUGOD knows the number of every kind of card, he wants to know the possibility that he can gain the meal.
Input
The first line of input contains an integer T, indicating the number of test cases (T ≤ 500).
Each case there are 15 integers x1, x2, ..., x15 indicating the number of A, 2, 3, ..., 10, J, Q, K, black joker, red joker. 0 ≤ x1, x2, ..., x13≤ 4, 0 ≤ x14, x15≤ 1, x1 + x2 ... + x15≥ 5.
Output
For each case output in a single line, contains the possibility of BIGZHUGOD can get big meal from his friends.
If the possibility is 0, output 0.
Otherwise, output p/q, where p and q are co-prime integers (have no common divisor greater than one).
Sample Input
2
4 4 4 4 4 4 4 4 4 4 4 4 4 1 1
1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
Sample Output
2681/35139
Description
BIGZHUGOD and his three friends are playing a game in a triangle ground.
The number of BIGZHUGOD is 0, and his three friends are numbered from 1 to 3. Before the game begins, three friends stand on three vertices of triangle in numerical order (1 on A, 2 on B, 3 on C), BIGZHUGOD stands inside of triangle.
Then the game begins, three friends run to the next vertex in uniform speed and in straight direction (1 to B, 2 to C, 3 to A and there speeds may different). And BIGZHUGOD can stand in any position inside the triangle.
When any of his friends arrives at next vertex, the game ends.
BIGZHUGOD and his friends have made an agreement: we assume that the beginning is time 0, if during the game, you can find a moment that BIGZHUGOD can block the sight line of 1 to C, 2 to A, 3 to B. Then each friend has to treat BIGZHUGOD with a big meal.
Now BIGZHUGOD knows the lengths of time that his three friends need run to next vertices t1, t2 and t3. He wants to know whether he has a chance to gain three big meals, of course he wants to know in which exciting moment t, he can block three friends' sight line.
Input
The first line contains an integer T, indicating the number of test cases (T ≤ 1000).
For each case there are three integer t1, t2, t3 (1 ≤ t1, t2, t3≤ 100).
Output
If BIGZHUGOD has a chance to gain big meal from his friends, output "YES" and the exciting moment t rounding to 4 digits after decimal point. Otherwise, output "NO".
Sample Input
2
1 1 1
3 4 6
Sample Output
YES 0.5000
YES 2.0000
Problem G. Cube Number
Description
In mathematics, a cube number is an integer that is the cube of an integer. In other words, it is the product of some integer with itself twice. For example, 27 is a cube number, since it can be written as 3 * 3 * 3.
Given an array of distinct integers (a1, a2, ..., a n), you need to find the number of pairs (a i, a j) that satisfy (a i * a j) is a cube number.
Input
The first line of the input contains an integer T (1 ≤ T ≤ 20) which means the number of test cases.
Then T lines follow, each line starts with a number N (1 ≤ N ≤ 100000), then N integers followed (all the integers are between 1 and 1000000).
Output
For each test case, you should output the answer of each case.
Sample Input
1
5
1 2 3 4 9
Sample Output
2
Problem H. Square Number
Description
In mathematics, a square number is an integer that is the square of an integer. In other words, it is the product of some integer with itself. For example, 9 is a square number, since it can be written as 3 * 3.
Given an array of distinct integers (a1, a2, ..., a n), you need to find the number of pairs (a i, a j) that satisfy (a i * a j) is a square number.
Input
The first line of the input contains an integer T (1 ≤ T ≤ 20) which means the number of test cases.
Then T lines follow, each line starts with a number N (1 ≤ N ≤ 100000), then N integers followed (all the integers are between 1 and 1000000).
Output
For each test case, you should output the answer of each case.
Sample Input
1
5
1 2 3 4 12
Sample Output
2
Problem I. Routing Table
Description
In the computer network, a Router is a device which finds an optimal way to transmit the datagrams passing through it to it's destination efficiently. To accomplish this task, the Router maintains a Routing Table.
The Routing Table stores a variety of relevant data about transmission path. In other words, the information contained in the table determines the forwarding strategy of a datagram.
Normally, the information in the Routing Table for each routing table entry is:
First the destination IP Address, followed by the number of bits of the sub-net mask, and finally the forwarded network port number of the destination network.
For each datagram passing through it, the Router compares the datagram’s destination IP Address with the information of routing table entry, if the network number of the destination IP Address is equals to the network number stored in the routing table entry, then the datagram is forwarded to the corresponding port.
Now, give you the Routing Table stored in the Router. Then for each datagram travel through this Router, give you it's destination IP Address, please return which network port will the datagram be forwarded to.
Input
The first line of input contains an integer T, indicating the number of test cases (T ≤ 20).
The first line of each test case contains two integers N and M, represent the number of entries in the Routing Table and the number of datagram passing through the Router, N and M are all less than 100000. Nest N lines each line represent a routing table entry, the format of input is IP Address/bits of sub-net mask and forwarded port number. And next M lines each line contain a destination IP Address. Please refer to the sample input for more detail.
Output
For each destination IP Address, please output the port number that the Router should forward. If there are many entry both match to this destination IP Address, please output the one that has the longest bits of sub-net mask. If there are also many entry match, please output the one that has the smallest port number. If there are none entry match, please output the default port 65535.
Sample Input
1
4 4
192.168.0.0/16 1234 192.168.1.0/24 1235 192.168.1.0/23 1233 192.168.0.0/23 1236 192.168.2.0
192.168.0.0
192.168.1.0
255.255.255.255 Sample Output 1234
1233
1235
65535
Problem J. Single Round Math
Description
Association for Couples Math (ACM) is a non-profit organization which is engaged in helping single people to find his/her other half. As November 11th is “Single Day”, on this day, ACM invites a large group of singles to the party. People round together, chatting with others, and matching partners.
There are N gentlemen and M ladies in the party, each gentleman should only match with a lady and vice versa. To memorize the Singles Day, ACM decides to divides to divide people into 11 groups, each group should have the same amount of couples and no people are left without the groups.
Can ACM achieve the goal?
Input
The first line of the input is a positive integer T. T is the number of test cases followed. Each test case contains two integer N and M (0 ≤ N, M ≤ 101000), which are the amount of gentlemen and ladies.
Output
For each test case, output “YES” if it is possible to find a way, output “NO” if not.
Simple Input
3
1 1
11 11
22 11
Sample Output
NO
YES
NO
Problem K. Last Hit
Description
Kirito likes playing LOL, but he is a noob who never wins. His teammates don't want to play with him anymore. After practicing with AI for months, he thinks it's time to return to the battlefield!
Now there are N enemy minions in front of him. He wants to give them the last hit to get more gold. The last hit means that the minion's HP is reduced to or below zero (HP ≤ 0) after this hit. The minions are attacking a defense tower now. The tower has enough HP so it will not be destroyed and Kirito will not be attacked.
Kirito can reduce a minion's HP by Y at each hit while the tower's attack value is X. The tower has the same attack speed as Kirito's, so if Kirito choose to attack at every opportunity they will take turns hitting the minions. Kirito can choose not to attack but the tower will keep attacking until all minions are killed. Besides, Kirito can choose which minion to hit but the tower will always attack the minion according to the input sequence.
As an observer of the game, you want to know how many last hits can Kirito get at most. Suppose the tower attacks first.
Input
The first line of input contains an integer T, indicating the number of test cases (T ≤ 100).
The first line of each test case contains three integers N, X, Y (1 ≤ N ≤ 1000, 0 ≤ X, Y ≤ 109).
Next line contains N integers representing the HP of each minion (1 ≤ HP ≤ 109).
Output
One line for each test case, containing the number of last hits can Kirito get.
Sample Input
2
3 1 1
1 2 3
3 2 1
3 2 1
Sample Output
2
2
Problem L. Circle of Friends
Description
Nowadays, "Circle of Friends" is a very popular social networking platform in WeChat. We can share our life to friends through it or get other's situation.
Similarly, in real life, there is also a circle of friends, friends would often get together communicating and playing to maintain friendship. And when you have difficulties, friends will generally come to help and ask nothing for return.
However, the friendship above is true friend relationship while sometimes you may regard someone as your friend but he doesn't agree. In this way when you ask him for help, he often asks you for a meal, and then he will help you.
If two people think they are friends mutually, they will become true friend, then once one of them has a problem or makes a query, the other one will offer help for free. What's more, if one relationship is similar to “A regards B as friend, B regards C as friend and C regards A as friend”, they will make a friends circle and become true friends too with each other. Besides, people will not ask those who they don’t regard as friends for help. If one person received a question and he cannot solve it, he will ask his friends for help.
Now, Nias encounters a big problem, and he wants to look for Selina's help. Given the network of friends, please return the minimum number of meals Nias must offer. Of course Nias is lavish enough, so he will pay for all the meals in the network of friends.
Input
The first line of input contains an integer T, indicating the number of test cases (T<=30).
For each test case, the first line contains two integers, N and M represent the number of friends in the Nias’s network and the number of relationships in that network. N and M are less than 100000 and you can assume that 0 is Nias and n-1 is Selina.
Next M lines each contains two integers A and B, represent a relationship that A regards B as his friend, A and B are between 0 and n-1.
Output
For each test case, please output the minimum number of meals Nias need to offer; if Nias can’t get Selina’s help, please output -1.
Sample Input
3
4 4
0 1
1 2
2 1
2 3
3 3
0 1
1 2
2 1
3 1
0 1
Sample Output 2
1
-1
全国中学生物理竞赛——纯电阻电路的简化和 等效变换 -CAL-FENGHAI-(2020YEAR-YICAI)_JINGBIAN
例析物理竞赛中纯电阻电路的简化和等效变换 李进 山东省邹平县第一中学 计算一个电路的电阻,通常从欧姆定律出发,分析电路的串并联关系。实际电路中,电阻的联接千变万化,我们需要运用各种方法,通过等效变换将复杂电路转换成简单直观的串并联电路。本节主要介绍几种常用的计算复杂电路等效电阻的方法。 1、等势节点的断接法 在一个复杂电路中,如果能找到一些完全对称的点(以两端连线为对称轴),那么可以将接在等电势节点间的导线或电阻或不含电源的支路断开(即去掉),也可以用导线或电阻或不含电源的支路将等电势节点连接起来,且不影响电路的等效性。 这种方法的关键在于找到等势点,然后分析元件间的串并联关系。常用于由等值电阻组成的结构对称的电路。 【例题1】在图8-4甲所示的电路中,R1 = R2 = R3 = R4 = R5 = R ,试求A、B 两端的等效电阻R AB。 模型分析:这是一个基本的等势缩点的事例,用到的是物理常识是:导线是等势体,用导线相连的点可以缩为一点。将图8-4甲图中的A、D缩为一点A 后,成为图8-4乙图。 3R 。 答案:R AB = 8 【例题2】在图8-5甲所示的电路中,R1 = 1Ω,R2 = 4Ω,R3 = 3Ω,R4 = 12Ω,R5 = 10Ω,试求A、B两端的等效电阻R AB。 模型分析:这就是所谓的桥式电路,这里先介绍简单的情形:将A、B两端接入电源,并假设R5不存在,C、D两点的电势相等。 因此,将C、D缩为一点C后,电路等效为图8-5乙
附件3 2014年第一届河北省大学生物理竞赛(实验部分)规则 参照国际青年物理学家锦标赛(IYPT)规则,本项竞赛以普通话为工作语言,以抽签分组、团队辩论的方式进行。赛前通过抽签分组,每支队伍均参加11月29日上午的对抗赛,每轮对抗赛由三支或四支队伍参赛。最后,依据各队竞赛成绩进行排名(见附件4),前10名进入下午的决赛。 每一轮对抗赛分为三个或四个阶段,若有三支队伍参赛,这三支参赛队在不同的阶段扮演三种不同角色,即:正方、反方和评论方,进行三个阶段的比赛。若有四支队伍参加,则这四支参赛队扮演四种不同角色,即:正方、反方、评论方和观摩方,进行四个阶段的比赛。每一轮对抗赛中角色的转换顺序如下: 三支队伍参加比赛 四支队伍参加比赛
每一阶段比赛定时50分钟,具体流程如下: 对抗赛中对不同角色的要求: 正方就某一问题做陈述时,要求重点突出,包括实验设计、实验结果、理论分析以及讨论和结论等。 反方就正方陈述中的弱点或者谬误提出质疑,总结正方报告的优点与缺点。但是,反方的提问内容不得包括自己对问题的解答,只能讨论正方的解答。 评论方对正反方的陈述给出简短评述。 观摩方不发表意见。 在每一阶段的比赛中,每支队伍只能由一人主控报告,其他队员只能做协助工作,可以和主控队员交流,但不能替代主控队员进行陈述。在每一轮对抗赛中每个队员最多只能作为主控队员出场两次。 作为正方,在一支队伍的全部比赛中,每个队员作为主控队员进行陈述次数不能超过三次。 题目挑战和拒绝规则:
在同一轮对抗赛中,题目不能相同。反方可以向正方挑战任何一道题目,正方可以拒绝一次而不被扣分,拒绝两次,将不计名次,不参与评奖。 成绩 在一轮对抗赛中,每一次阶段赛过后,每位裁判就各队承担的角色表现打分,分数为1 至10 分的整数分数,裁判组的平均分数作为该阶段赛的成绩(角色成绩),计算参赛队的一轮比赛成绩时,不同角色的加权系数不同:正方:× 3.0; 反方:× 2.0 评论方:×1.0 各参赛队在一轮对抗赛中的成绩为各阶段赛成绩的加权总和,并把结果四舍五入保留一位小数。各参赛队的总成绩为该队在所有对抗赛中取得的成绩总和。以参赛总成绩进行排名。 2014年第一届河北省大学生物理竞赛组委会 2014年10月14日
数学与统计学院 第三届计算机程序设计竞赛题 竞赛需知: 1、答案必须写在答题纸上。 2、程序采用C/JAVA/VB/VFP语言实现均可。 3、考虑到各种因素,程序的键盘输入和结果输出可以用伪代码或者自然语言表示。但是必 须说明输入变量和输出变量。 4、题目最好能用完整、正确的语言程序来解决问题,如确实无法编写完整语言程序的,可 以写出程序主要框架和流程,必要时可以用伪代码或者自然语言描述算法(程序)。 一、玫瑰花数(20分) 如果一个四位数等于它的每一位数的4次方之和,则称为玫瑰花数。例如: + + 1634+ =, 4^4 4^3 4^6 4^1 编程输出所有的玫瑰花数。 #include
int i,j,k; int n; scanf("%d",&n); for(i=0;i 程序设计比赛试题 最少钱币数: 【问题描述】 这是一个古老而又经典的问题。用给定的几种钱币凑成某个钱数,一般而言有多种方式。例如:给定了6种钱币面值为2、5、10、20、50、100,用来凑15元,可以用5个2元、1个5元,或者3个5元,或者1个5元、1个10元,等等。显然,最少需要2个钱币才能凑成15元。 你的任务就是,给定若干个互不相同的钱币面值,编程计算,最少需要多少个钱币才能凑成某个给出的钱数。 【要求】 【数据输入】输入可以有多个测试用例。每个测试用例的第一行是待凑的钱数值M (1<=M<=2000,整数),接着的一行中,第一个整数K(1<=K<=10)表示币种个数,随后是K个互不相同的钱币面值Ki(1<=Ki<=1000)。输入M=0时结束。 【数据输出】每个测试用例输出一行,即凑成钱数值M最少需要的钱币个数。如果凑钱失败,输出“Impossible”。你可以假设,每种待凑钱币的数量是无限多的。 【样例输入】 15 6 2 5 10 20 50 100 1 1 2 【样例输出】 2 Impossible Feli的生日礼物 【问题描述】 Felicia的生日是11月1日(和Kitty是同一天生的哦)。于是Feli请来Kitty一起过生日。Kitty带来了最新款的“Kitty猫”玩具准备送给Feli,不过她说,这份礼物可不是白送的。Feli要帮她一个忙,才能够得到心仪已久的玩具。Kitty说,“Kitty猫”玩具已经卖出了n!个,n<=10^100*_*,Kitty想知道确切的数字,而不是无聊的“一个数加个感叹号”。Feli听了大吃一惊。要知道,算出n!是一个无比艰巨的任务。Feli告诉Kitty,就算Feli算出n!,Kitty也看不下去,因为当n=20时,计算机的长整型已经存不下了(Kitty只能接受1-9之间的数字)。于是Kitty说,你只要告诉我n!最后一位非0的数就可以了。Feli想了想,立刻动手写了个程序算出了正确的答案。现在,请你也试试看!注意哦,AC的男生将会得到一个“Hello Kitty”计算器(可编程,CPU 1THz,Mem 1TMB),AC的女生将会得到一个仿真“Hello Kitty”宠物(善解人意,无须喂养,智商1101,附带写情书功能)。 【要求】 【数据输入】每行一个n,直到输入数据结束 【数据输出】对应输入的n,每行输出一个答案 【样例输入】 1101 【样例输出】 8 新泰一中高二物理学科竞赛试题 一、选择题(共14小题,每小题4分,共56分,在每小题给出的四个选项中,有的小题只有一个选项符合题目要求。有的小题有多个选项符合题目要求.全部选对的得4分,选对但不全的得2分,有选错的得0分,多选已标出). 1.关于磁感应强度,下列说法中正确的是( ) A.由B= IL F 可知,B 与F 成正比,与IL 成反比 B.由B= IL F 可知,一小段通电导线在某处不受磁场力,则说明该处一定无磁场 C .把一小段通电导线放在磁场中某处,所受的磁场力与该小段通电导线的长度和电流的乘积的比值表示该处磁场的强弱 D.磁感应强度的方向就是小磁针北极受力的方向 2.如图所示,空间存在垂直纸面向里的匀强磁场,一带负电的物块在水平外力F 作用下沿粗糙水平面向右做匀加速直线运动,下列关于外力F 随时间变化的图象可能正确的是( ) A . B . C . D . 3.右图是科学史上一张著名的实验照片,显示一个带电粒子在云室中穿过某种金属板运动的径迹。云室旋转在匀强磁场中,磁场方向垂直照片向里。云室中横放的金属板对粒子的运动起阻碍作用。分析此径迹可知粒子( ) A. 带正电,由下往上运动 B. 带正电,由上往下运动 C. 带负电,由上往下运动 D. 带负电,由下往上运动 4. 三个质子1、2和3分别以大小相等、方向如图所示的初速度v1、v2和v3经过平板MN 上的小孔O射入匀强磁场B,磁场方向垂直纸面向里,整个装置处在真空中,且不计重力.最终这三个质子打到平板MN上的位置到小孔的距离分别为s1、s2和s3,则( ) A.s1<s2<s3 B.s2>s3>s1 C.s1=s3>s2 D.s1=s3<s2 5.在如图所示的电路中,a、b为两个完全相同的灯泡,L为自感线圈,E为电源,S为开关。下列说法正确的是( ) A.合上开关S,a、b同时亮 B.合上开关S,a先亮、b后亮 C.将原来闭合的开关S断开,a先熄灭、b后熄灭 D.将原来闭合的开关S断开,b先熄灭、a后熄灭 6.所示装置中,cd杆原来静止。当ab杆做如下哪些运动时,cd杆将向右移动() A.向右匀速运动B.向左匀速运动 D.向左加速运动C.向右加速运动 7. (多选)如图为一个电磁泵从血库里向外抽血的结构示意图,长方体导管的左、右表面绝缘,上、下表面为导体,管长为a、内壁高为b、宽为L且内壁光滑.将导管放在垂直左、右表面向右的匀强磁场中,由于充满导管的血浆中带有正、负离子,将上、下表面和电源接通,电路中会形成大小为I的电流,导管的前后两侧便会产生压强差p,从而将血浆抽出, 一、鸡兔同笼 问题描述 一个笼子里面关了鸡和兔子(鸡有2只脚,兔子有4只脚,没有例外)。已经知道了笼子里面脚的总数a,问笼子里面至少有多少只动物,至多有多少只动物 输入数据 第1行是测试数据的组数n,后面跟着n行输入。每组测试数据占1行,包括一个正整数a (a < 32768)。 输出要求 n行,每行输出对应一个输入。输出是两个正整数,第一个是最少的动物数,第二个是最多的动物数,两个正整数用空格分开。如果没有满足要求的情况出现,则输出2个0。 输入样例 2 3 20 输出样例 0 0 5 10 解题思路 这个问题可以描述成任给一个整数N,如果N是奇数,输出0 0,否则如果N是4的倍数,输出N / 4 N / 2,如果N不是4的倍数,输出N/4+1 N/2。这是一个一般的计算题,只要实现相应的判断和输出代码就可以了。题目中说明了输入整数在一个比较小的范围内,所以只需要考虑整数运算就可以了。 参考程序 1.#include 湖南省第4届大学生物理竞赛试卷 2011年5月14日 时间:150分钟 满分120分 一、 选择题 (每题3分,共18分) 1.设某种气体的分子速率分布函数为)(v f ,则速率在1v ~2v 内的分子的平均速率为 ( )。 (A) ?21)(v v v d v vf ; (B) ?2 1)(v v v d v f v ; (C) ??2121)()(v v v v v d v f v d v vf ; (D) ??∞0)()(21v d v f v d v f v v 。 2. 如图所示带负电的粒子束垂直地射入两磁铁之间的水平磁场,则( )。 (A) 粒子向N 极移动; (B) 粒子向S 极移动; (C) 粒子向下偏转; (D) 粒子向上偏转。 3.如图所示,一个带电量为 q 的点电荷位于立方体的 A 角 上,则通过侧面 abcd 的电场强度通量等于( )。 A 、 06εq ; B 、012εq ; C 、 024εq ; D 、048εq 。 4. 如图a 所示, 一光学平板玻璃 A 与待测元件 B 之间 形成空气劈尖,用波长 nm 500=λ 的单色光垂直照射,看 到的反射光的干涉条纹如图b 所示,有些条纹弯曲部分的 顶点恰好于其右边条纹的直线部分的切线相切,则工件的 上表面缺陷是 ( ) 。 (A ) 不平处为凸起纹,最大高度为nm 500; (B ) 不平处为凸起纹,最大高度为nm 250; (C ) 不平处为凹槽,最大高度为nm 500; A q c b d a (D ) 不平处为凹槽,最大高度为nm 250。 5. 在图示三种透明材料构成的牛顿环装置中,用单色光垂 直照射,在反射光中看到干涉条纹,则在接触点P 处形成 的圆斑为( ) 。 (A) 全明; (B) 全暗; (C) 右半部明,左半部暗; (D) 右半部暗,左半部明。 6. 已知粒子在一维矩形无限深势阱中运动,其波函数为: a x a x 23cos 1)(πψ?= )(a x a ≤≤- 那么粒子在6/5a x =处出现的几率密度为( )。 (A) )2/(1a ; (B) a /1 ; (C) a 2/1 ; (D) a /1 。 二、填空题(每题3分,共21分) 1. 一匀质细杆长为l ,质量为m ,杆两端用线吊起,保持水平,现 有一条线突然断开,则断开瞬间另一条线的张力 为 。 2. 图示两条曲线分别表示氦、氧两种气体在相同温度T 时 分子按速率的分布,其中曲线 1 表示 _ _气分子的 速率分布曲线,曲线 2 表示 __ _ 气分子的速率 分布曲线。 3. 一氧气瓶的容积为V ,充入氧气的压强为1P ,用了一段时间 后压强降为2P ,则瓶中剩下的氧气的内能与未用前氧气的内能 之比为 。 4. 长直导线中通有电流 I ,长L 的金属棒AB 以速度V 平行于 长直导线作匀速运动。棒近导线一端与导线的距离为a ,则金属棒中的感应电动v f(v) 1 2 I a l V A B 湖南省第 3 届大学生物理竞赛试卷 (2010 年 4 月 24 日) 时间 150 分钟 满分 120 分 一、选择题(每题 3 分,共 12 分) 1、真空中波长为的单色光,在折射率为 n 的透明介质中从 A 沿某路径传播到 B ,若A ,B 两点相位差为3,则此路径 AB 的光程为 [ ] (A) 1.5 (B) 1.5n (C) 1.5n (D) 3 2、氢原子中处于 2p 状态的电子,描述其量子态的四个量子数(n , l , m l , m s ) 可能取的值为 [ ] (A) (2, 2,1, - 1 ) 2 (B) 1 (2, 0, 0, ) 2 (C) (2,1, -1, - 1 ) 2 1 (D) (2, 0,1, ) 2 3、某元素的特征光谱中含有波长分别为 = 450nm 和 = 750nm (1nm = 10-9 m )的 1 2 光谱线。在光栅光谱中,这两种波长的谱线有重叠现象,重叠处 2 的谱线的级数将是 [ ] (A) 2,3,4,5…… (B) 2,5,8,11…… (C) 2,4,6,8…… (D) 3,6,9,12…… 4、长为 2L 、质量为 m 的均匀直棒的两端用绳自天花板竖直吊住,若一端突然剪断,剪断 绳的瞬间另一端绳中的张力为: [ ] (A) 1 mg 2 (B) mg (C) 3 mg 4 (D) 1 mg 4 二、填空题(每题 3 分,共 18 分) 1、电子枪的加速电压U = 5?104V ,则电子的速度(考虑相对论效应) ,电子的德布罗意波长 。 2、弦上一驻波,其相邻两节点的距离为65cm ,弦的振动频率为230Hz ,则波长为 ,形成驻波的行波的波速为 。 3、长为 L 的铜棒 ab 在垂直于匀强磁场 B 的平面内以角速度作逆时 针转动, B 垂直于转动平面向里,如图所示。则棒中的动生电动势为 a ,a 、b 两端何端电势高 (填 a 或 b )。 4、一均匀带正电的无限长直导线,电荷线密度为,其单位长度上总共发出的电场线(E 线)的条数是 。 5、用白光垂直照射在厚度为4 ?10-5 cm ,折射率为 1.5 的薄膜表面上,在可见光范围内, b B 试题 1、数学黑洞(程序文件名maths.c/maths.cpp) 【问题描述】 任给一个4位正整数,其各位数位上的数字不全相同,将数字重新组合成一个最大的数与最小的数相减,重复这个过程,最多7步,必得6174。对任给的4位正整数(各位数位上的数字不全相同),编程输出掉进黑洞的步数。 【输入】 一行,一个4位正整数n(1000< n<9999) 【输出】 掉进黑洞的步数 输入 1234 输出 3 2、进制转换(程序文件名conver.c/conver.cpp) 【问题描述】 任给一个十进制整数n,及正整数m(m<=16且m≠10), 将n转换成m进制并输出。 【输入】 一行,两个整数n,m(0 ≤ n ≤ 500000,2 ≤ m ≤ 16,且m≠10),中间用一个空格隔开,其中n 表示十进制数。 【输出】 转换后的数 【输入输出样例】 输入 255 8 输出 377 3、分数线划定(程序文件名score.c/score.cpp) 【问题描述】 公务员选拔工作正在 A 市如火如荼的进行。为了选拔优秀人才,A 市对所有报名的选手进行了笔试,笔试分数达到面试分数线的选手方可进入面试。面试分数线根据计划录取人数的150%划定,即如果计划录取m名公务员,则面试分数线为排名第m*150%(向下取整)名的选手的分数,而最终进入面试的选手为笔试成绩不低于面试分数线的所有选手。现在就请你编写程序划定面试分数线,并输出所有进入面试的选手的报名号和笔试成绩。 【输入】 第一行,两个整数n,m(5 ≤ n ≤ 5000,3 ≤ m ≤ n),中间用一个空格隔开,其中n 表示报名参加笔试的选手总数,m 表示计划录取的人数。输入数据保证m*150%向下取整后小于等于n。 第二行到第 n+1 行,每行包括两个整数,中间用一个空格隔开,分别是选手的报名号k(1000 ≤ k ≤ 9999)和该选手的笔试成绩s(1 ≤ s ≤ 100)。数据保证选手的报名号各不相同。 【输出】 第一行,有两个整数,用一个空格隔开,第一个整数表示面试分数线;第二个整数为进入面试的选手的实际人数。 从第二行开始,每行包含两个整数,中间用一个空格隔开,分别表示进入面试的选手的报名号和笔试成绩,按照笔试成绩从高到低输出,如果成绩相同,则按报名号由小到大的顺序输出。 【输入输出样例】 输入 6 3 1000 90 3239 88 2390 95 7231 84 1005 95 1001 88 第2届大学生物理竞赛试卷 (2009年4月25日) 时间150分钟 满分120分 一、填空题(共52分) 1、(4分)人造地球卫星绕地球作圆周运动,由于受到空气摩擦阻力,人造卫星速度____________(填减小或增大或不变),轨道半径________________(填减小或增大或不变)。 2、(4分)面积为S 的接地金属板,距板为d 处有一点电荷q +(q 很小),则板上离点电荷最近处的感应电荷面密度为___________________________。 3、(4分)半圆形载流线圈,半径为R ,电流为I 与B 共面,且直 径与B 夹角为θ。则线圈受的磁力矩大小为 _____________________;方向___________________。 4、(3分)从单一热源吸取热量并将其完全用来对外作功,则[ ](请选A 或B 并填空) A 、此过程违反热力学第二定律; B 、此过程不违反热力学第二定律,例如_______________过程就是这种情况。 5、(4分)图中MN 为某理想气体的绝热曲线,AB C 是任意过程,箭头表示过程进行的方向,ABC 过程结束后气体的温度_______________(填 增加、减小或不变);气体所吸收的热量为_______________(填正、负 或零)。 6、(6分)标准声源能发出频率为250.0o Hz ν=的声波,一音叉与该标准声 源同时发声,产生频率为1.5Hz 的拍音,若在音叉的臂上粘上一小块橡皮泥, 则拍频增加,音叉的固有频率ν_________________;将上述音叉置于盛水的玻璃管口,调节管中水面的高度,当管中空气柱高度L 从零连续增加时,发现在0.34L m =和1.03m 时相继产生两次共鸣,由以上数据算得声波在空气中的传播速度_________________________。 7、(5分)一容器内储有1mol 氧气,其压强为1atm ,温度为27℃,则单位体积中的分子数n =__________________,分子的平均速率v =____________________;氧气的内能E =______________________。 8、(5分)一束光强为0I 的自然光连续通过三个偏振片,它们的偏振化方向分别为13P P ⊥, 2P 与3P 夹角为θ,当出射光强I 为03I 时,θ角的大小为___________________。 q B 日本一位中学生发现一个奇妙的“定理”,请角谷教授证明,而教授无能为力,于是产生角谷猜想。猜想的内容是:任给一个自然数,若为偶数除以2,若为奇数则乘3加1,得到一个新的自然数后按照上面的法则继续演算,若干次后得到的结果必然为1。请编程验证。 *问题分析与算法设计 本题是一个沿未获得一般证明的猜想,但屡试不爽,可以用程序验证。 题目中给出的处理过程很清楚,算法不需特殊设计,可按照题目的叙述直接进行证。 *程序说明与注释 #include程序设计比赛试题
2018-2019学年山东省泰安市新泰一中高二上学期竞赛物理试卷
第六届程序设计比赛题目与答案
湖南省大学生物理竞赛试卷及答案
(完整版)湖南大学生物理竞赛试题及答案,推荐文档
程序设计大赛试题及答案
第2届大学生物理竞赛试题
C语言程序设计大赛题目