编程之美
2015-09-29 20:26
211 查看
题目1 : Farthest Point
时间限制:5000ms单点时限:1000ms
内存限制:256MB
描述
Given a circle on a two-dimentional plane.Output the integral point in or on the boundary of the circle which has the largest distance from the center.
输入
One line with three floats which are all accurate to three decimal places, indicating the coordinates of the center x, y and the radius r.For 80% of the data: |x|,|y|<=1000, 1<=r<=1000
For 100% of the data: |x|,|y|<=100000, 1<=r<=100000
输出
One line with two integers separated by one space, indicating the answer.If there are multiple answers, print the one with the largest x-coordinate.
If there are still multiple answers, print the one with the largest y-coordinate.
样例输入
1.000 1.000 5.000
样例输出
6 1
题目2 : Total Highway Distance
时间限制:10000ms单点时限:1000ms内存限制:256MB
描述
Little Hi and Little Ho are playing a construction simulation game. They build N cities (numbered from 1 to N) in the game and connect them by N-1 highways. It is guaranteed that each pair of cities are connected by the highways directly or indirectly.The game has a very important value called Total Highway Distance (THD) which is the total distances of all pairs of cities. Suppose there are 3 cities and 2 highways. The highway between City 1 and City 2 is 200 miles and the highway between City 2 and City 3 is 300 miles. So the THD is 1000(200 + 500 + 300) miles because the distances between City 1 and City 2, City 1 and City 3, City 2 and City 3 are 200 miles, 500 miles and 300 miles respectively.During the game Little Hi and Little Ho may change the length of some highways. They want to know the latest THD. Can you help them?输入
Line 1: two integers N and M.Line 2 .. N: three integers u, v, k indicating there is a highway of k miles between city u and city v.Line N+1 .. N+M: each line describes an operation, either changing the length of a highway or querying the current THD. It is in one of the following format.EDIT i j k, indicating change the length of the highway between city i and city j to k miles.QUERY, for querying the THD.For 30% of the data: 2<=N<=100, 1<=M<=20For 60% of the data: 2<=N<=2000, 1<=M<=20For 100% of the data: 2<=N<=100,000, 1<=M<=50,000, 1 <= u, v <= N, 0 <= k <= 1000.输出
For each QUERY operation output one line containing the corresponding THD.样例输入3 5 1 2 2 2 3 3 QUERY EDIT 1 2 4 QUERY EDIT 2 3 2 QUERY样例输出10 14 12
题目3 : Fibonacci
时间限制:10000ms单点时限:1000ms内存限制:256MB
描述
Given a sequence {an}, how many non-empty sub-sequence of it is a prefix of fibonacci sequence.A sub-sequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.The fibonacci sequence is defined as below:F1 = 1, F2 = 1Fn = Fn-1 + Fn-2, n>=3输入
One line with an integer n.Second line with n integers, indicating the sequence {an}.For 30% of the data, n<=10.For 60% of the data, n<=1000.For 100% of the data, n<=1000000, 0<=ai<=100000.输出
One line with an integer, indicating the answer modulo 1,000,000,007.样例提示
The 7 sub-sequences are:{a2}{a3}{a2, a3}{a2, a3, a4}{a2, a3, a5}{a2, a3, a4, a6}{a2, a3, a5, a6} 样例输入6 2 1 1 2 2 3样例输出7
题目4 : Image Encryption
时间限制:10000ms单点时限:1000ms内存限制:256MB描述
A fancy square image encryption algorithm works as follow:0. consider the image as an N x N matrix1. choose an integer k∈ {0, 1, 2, 3}2. rotate the square image k * 90 degree clockwise3. if N is odd stop the encryption process4. if N is even split the image into four equal sub-squares whose length is N / 2 and encrypt them recursively starting from step 0Apparently different choices of the k serie result in different encrypted images. Given two images A and B, your task is to find out whether it is POSSIBLE that B is encrypted from A. B is possibly encrypted from A if there is a choice of k serie that encrypt A into B.
输入
Input may contains multiple testcases.The first line of the input contains an integer T(1 <= T <= 10) which is the number of testcases.The first line of each testcase is an integer N, the length of the side of the images A and B.The following N lines each contain N integers, indicating the image A.The next following N lines each contain N integers, indicating the image B.For 20% of the data, 1 <= n <= 15For 100% of the data, 1 <= n <= 100, 0 <= Aij, Bij <= 100000000输出
For each testcase output Yes or No according to whether it is possible that B is encrypted from A.样例输入3 2 1 2 3 4 3 1 4 2 2 1 2 4 3 3 1 4 2 4 4 1 2 3 1 2 3 4 2 3 4 1 3 4 1 2 3 4 4 1 2 3 1 2 1 4 4 3 2 1 3 2样例输出
Yes No Yes
相关文章推荐
- JdbcHelper.java(JAVA连接数据库后的备忘录的增删改查)
- 深入剖析Java中的装箱和拆箱
- python--tile函数
- C语言qsort函数算法性能测试
- Java时间类型转换
- MINA2 源代码学习--源代码结构梳理
- 关于代码规范的个人观点及伙伴个人项目的代码复审
- 浅析Java中的final关键字
- Java 格式化数字
- 软件实习笔记一(Qt安装与简单使用)
- 面试之C语言字符串操作总结大全(转载)
- git连接到github(SSH无密码登陆)
- C++中一个类对象占用的内存空间大小
- Java虚拟机10:类加载器
- git连接到github(SSH无密码登陆)
- GOF 23设计模式之 组合模式(composite)
- c语言学习笔记(10)编译器编译过程分析
- NetBeans里几个比较实用的小方法
- python 给文件批量加‘“’ ”,"
- java连接sql server 2008和连接sql server 2008