一,求最大,最小值 int[] a={21,31,4,2,766,345,2,34}; //这里防止数组中有负数,所以初始化的时候给的数组中的第一个数. int max=a[0]; int min=a[0]; for (int i = 0; i < a.length; i++) { if(a[i]>max) max=a[i]; if(a[i]<min) min=a[i]; } System.out.println("最大的数是:"+max); System.out.p
Problem Description Chinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to develop a new tickets query system.One train can just take k passangers. And each passanger can just
//qq 767039957 welcome #include<cstdio> #include<algorithm> #include<vector> #include<queue> #include<cmath> #include<iostream> using namespace std; typedef long long LL; typedef unsigned long long ULL; //这里有点类似于隔离分析法,设
Polycarp has a lot of work to do. Recently he has learned a new time management rule: "if a task takes five minutes or less, do it immediately". Polycarp likes the new rule, however he is not sure that five minutes is the optimal value. He suppo
题目: Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000). His C (2 <= C <= N) cows don't like this barn layout and become
public class ArrayDemo05 { public static void main(String[] args) { int list01[]={67,89,87,69,90,100,75,90}; int max; int min; max=min=list01[0]; for(int i=0;i<list01.length;i++){ if (list01[i]>max) max=list01
链接:https://vjudge.net/contest/66989#problem/G 完完全全的水题,还是被坑了,一个return忘了写,de了半天bug!! #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define ls l,m,rt<<1 #defi