第一范文网 - 专业文章范例文档资料分享平台

第三届仲恺农业工程学院程序设计竞赛(ACM)试题

来源:用户分享 时间:2025/9/8 2:41:40 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

E. Intersect

If a point P is on the segment AB and another segment CD at the same time, we say that P is an intersect point for AB and CD.

For two segments in two dimensions, how many intersect point do they have? Input

There are multiple test cases.

For each test case: the first line contains 4 integers represent th x-coordinate of point A, y-coordinate of point A, x-coordinate of point B, y-coordinate of point B, the second line contains 4 integers represent th x-coordinate of point C, y-coordinate of point C, x-coordinate of point D, y-coordinate of point D.

You can assume for all input integers v,-2<=v<=2, and A and B are always at different position,, C and D are always at different position, too. Output

For each test case:

If AB and CD have no intersect point , output a single line contains the string \If AB and CD have just one intersect point, output a single line contains the string \ If AB and CD have more than one intersect point (such as many), output a single line contains the string \Sample Input -2 -2 -2 -1 -2 -2 -2 2 -2 -2 -2 -1 -2 -2 -1 0 Sample Output Many One

F. Be Good at Gaussing

Give you many positive integer N (N<=23),for each N,just output N*(N+1)/2 integers in a single line,separated by space. (Don't ask me why.)For each N,the output line contains integers from 1 to N,and each just once.Again,do not ask me why,thank you.I'm so busy.But I can tell you a secret,the output has relationship with number triangle.As:(N=3) 1 2 6 3 4 5 See the sample for more information. Input

a positive integer N (N<=23). Output

For each N,output N*(N+1)/2 integers in a single line,separated by a blank space. Sample Input 3 4 2 6

Sample Output 1 2 6 3 4 5 1 2 9 3 10 8 4 5 6 7 1 2 3

1 2 15 3 16 14 4 17 21 13 5 18 19 20 12 6 7 8 9 10 11

G. A Multiply Problem

Our problem is,for a giving M rows and M columns matrix A, output another matrix B=AN. Input

For each test cases, there are two integers M and N in a single line. You can assume that 1<=M<=4,,0<=N<=4.

Then,M row M column integers value v followed. The ith row and jth column v represent a the ith row and jth column of matrix A. You can assume that for each v, -10<=v<=10. Output

Output M rows M columns integers represent the matrix B.

Each line of the output should contain M integers and these M integers should be separated by blank spaces. You must know no blank space after the last integer of each line. Sample Input 2 2 9 7 5 1

Sample Output 116 70 50 36

H. Count

Many ACM team name may be very funny, such as \minute here.

Is it \we can treat this name \For 5 'V's,our have 8 ways.They are:

1. V V V V V 2. V W W 3. W W V

4. V W V V 5. W V W 6. W V V V 7. V V W V 8. V V V W

The problem here is that for n 'V's,how many ways do we have to treat it?Because the answer may be too large, you should output the answer module by p.(If n is 0,then we have just

one way.) Input

There are multiple test cases. The first line of the input contains an integer M, meaning the number of the test cases.

For each test cases, there are two integers n and p in a single line. Output

For each test case, output the answer with case number in a single line. Sample Input 2 5 5 4 7

Sample Output 3 5

第三届仲恺农业工程学院程序设计竞赛(ACM)试题.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c46j484a1du4g4gh0l15v_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top