Blog·Tanky WooABOUTRSS


09 Sep 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

今天是第一次在TopCoder上做题,本来今天有SRM481的比赛的。不过我注册时已经截至了。 晚上在赵牛的帮助下,弄了半天才注册上。 先是一大堆的注册相关信息,但是注册完后半天没有收到注册邮件,在赵牛的提醒下,才发现,居然没TX当成垃圾邮件了。。。然后又是电脑本地没JAVA,于是赵牛给我传了一个JDK,接着就是下载安装TopCoder Arena了。。。

注册一路真实坎坷的。。。不过还好,终于注册上了,打开TC,幽黑的背景,灵异的绿色,有点。。。恐怖哈。 于是自己找了一个练习场试试. 今天我学到了几点: SRM,经常听别人说,现在终于知道了是 Single Round Match的简写。 因为是基于java的,不能右键点击赋值,只能Ctrl+C复制 和 Ctrl + V 粘贴。 在练习场我选择了SRM480的DIV2,因为250的题目最简单,所以直接做了这题,题目是让写一个类,基本上没什么思想,就是sort排序,然后long long类型的数相乘即可。


Problem Statement TopCoder Security Agency (TSA, established today) has just invented a new encryption system! This encryption system takes as its input a list of numbers to encrypt. You work at TSA and your task is to implement a very important part of the encryption process. You are allowed to pick one number in the input list and increment its value by 1. This should be done in such way that the product of all numbers in the list after this change becomes as large as possible. Given the list of numbers as vector numbers, return the maximum product you can obtain. It is guaranteed that the return value will not exceed 2^62. Definition Class: Cryptography Method:encrypt Parameters:vector Returns:long long Method signature:long long encrypt(vector numbers) (be sure your method is public) Constraints - numbers will contain between 2 and 50 elements, inclusive. - Each element of numbers will be between 1 and 1000, inclusive. - The return value will not exceed 2^62. Examples 0) {1,2,3} Returns: 12 If we increment the first number, we get 2*2*3 = 12. If we increment the second, we get 1*3*3 = 9. If we increment the third, we get 1*2*4 = 8. Hence, the correct return value is 12. 1) {1,3,2,1,1,3} Returns: 36 The elements of numbers are not necessarily unique. 2) {1000,999,998,997,996,995} Returns: 986074810223904000 The answer may be very big, but will not exceed 2^62. 3) {1,1,1,1} Returns: 2 This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.