随笔分类 - Search
摘要:class Solution { public int firstMissingPositive(int[] nums) { int i=0; while(i0&&nums[i]<=nums.length&&nums[i]!=nums[nums[i]-1]) { int tmp=nums[i]; ...
阅读全文
摘要:class Solution { public int threeSumClosest(int[] nums, int target) { Arrays.sort(nums); int ret=nums[0]+nums[1]+nums[2]; for(int i=0;i<nums.length;i++) { ...
阅读全文
摘要:class Solution { public List> threeSum(int[] nums) { List> ret=new ArrayList>(); Arrays.sort(nums); for(int i=0;i0) r--; else ...
阅读全文
摘要:public class Solution { public double findMedianSortedArrays(int[] nums1, int[] nums2) { int l=(nums1.length+nums2.length+1)>>1; int r=(nums1.length+nums2.length+2)>>1; re...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3965Accepted: 1505Special JudgeDescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N o...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 4863Accepted: 1058DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficie...
阅读全文
摘要:Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 1798Accepted: 784DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from ro...
阅读全文
摘要:Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 4105Accepted: 1620DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4872Accepted: 2507DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that e...
阅读全文
摘要:Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 5414Accepted: 2567Special JudgeDescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller square...
阅读全文
摘要:Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1307 Accepted: 764DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Alt...
阅读全文
摘要:Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 3311Accepted: 1346DescriptionA university network is composed of N computers. System administrators gathered information on the traffic between...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2779Accepted: 1167Special JudgeDescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations ca...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3134Accepted: 1911DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would al...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4446Accepted: 1908Special JudgeDescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal repre...
阅读全文
摘要:Time Limit: 3000MSMemory Limit: 65536KTotal Submissions: 12536Accepted: 5529DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign l...
阅读全文
摘要:Time Limit: 3500MSMemory Limit: 65536KTotal Submissions: 6320Accepted: 2024DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a...
阅读全文
摘要:Time Limit: 5000MSMemory Limit: 65536KTotal Submissions: 3409Accepted: 1514DescriptionConsider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 The coefficients are given integ...
阅读全文
摘要:Hash Tablehash function1. for(int j=0; j<K; ++j) key=((key<<2)+(cnt[j]>>4))^(cnt[j]<<10);2. z = cnt.size()for(int j=0; j < K; ++j) z = 3179(质数)* z + cn...
阅读全文
摘要:hash tableDescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collectio...
阅读全文

浙公网安备 33010602011771号