程独秀
lohiecan
JSRUN的第18位用户
加入于 2016-04-18
上次活跃 2020-07-10



就是这么秀

import java.util.*;

class Main {
	public static void main(String[] args) { 
        // LinkedList 实现了 Queue 接口
        LinkedList<Integer> list = new LinkedList<Integer>();

        for(int i =0;i<300;i++){
            list.add(i);
        }
        int size=list.size();
        //只保留200个, 将其他数据按先进先出的规则弹出
        if (list.size() > 200) {  
            for (int i = size ; i >200; i--) {
                list.poll();
             }
        }
        for (int i = 0 ; i <200; i++) {   
		    System.out.print(list.get(i)+",");
        }
	}
}
lohiecan (程独秀 )- 2020-07-10 0 人
java Queue 应用,先进先出用法实例, ...
class Main {
	public static void main(String[] args) {  
        for(TestEnum e:TestEnum.values()){
            System.out.println(e.getName());
        }
	}
}

enum TestEnum { 
    C(1, "c"),
    GO(2, "go"),
    CPP(3, "cpp"),
    GROOVY(4, "groovy"), 
    FSHARP(5, "fsharp") ,
    VB(6, "vb") ,
    SWIFT(7, "swift") ,
    DART(8, "dart") ,
    R(9, "r") ,
    CLOJURE(10, "clojure") ,
    KOTLIN(11, "kotlin") ,
    RUST(12, "rust") ,
    PASCAL(13, "pascal") ,
    PERL(14, "perl") , 
    ;

    private String name;
    private int code;

    TestEnum(int code, String name) {
        this.name = name;
        this.code = code;
    }
  
    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }
}
lohiecan (程独秀 )- 2020-06-19 1 人
java enum枚举遍历
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

#define N 5000+10
struct node{
    int l;
    int w;
};
struct node num[N];
int cmp(struct node a,struct node b)
{
    if(a.l == b.l )
        return a.w < b.w ;
    return a.l < b.l ;
}
int main()
{
    int t,book[N];
    int n,i,j,sumtime,sum,x;
    //scanf("%d",&t);
    //while( t --)
    //{
        scanf("%d",&n);
        for(i = 1; i <= n; i ++)
            scanf("%d%d",&num[i].l ,&num[i].w );
        sort(num+1,num+n+1,cmp);
        memset(book,0,sizeof(book));
        sumtime = 0;
        sum = n;
        for(i = 1; i <= n; i ++)
        {

            if(!book[i])
            {
                x = i;
                book[i] = 1;
                sum --;
                for(j = i+1; j <= n; j ++)
                {
                    if(num[x].l <= num[j].l &&num[x].w <= num[j].w&&!book[j])
                    {
                        book[j] = 1;
                        x = j;
                        sum --;
                    }
                }
                sumtime++;
            }
            if(sum <= 0)
                break;
        }
        printf("%d\n",sumtime);

   // }
    return 0;
 } 
lohiecan (程独秀 )- 2020-06-14 0 人
巧克力加工c++问题
for i in range(6):
    print(bin(i + 1).replace('0b', '').zfill(3)) 
lohiecan (程独秀 )- 2020-06-14 0 人
python循环实现打印001到110
var fruits = ["Apple", "Banana", "Apple", "Orange", "Orange", "Mango"];
var a = fruits.lastIndexOf("Apple");
console.log(a);
lohiecan (程独秀 )- 2020-06-13 0 人
js 数组查找最后一个出现的元素 lastInde...
var fruits = ["Banana", "Orange", "Apple", "Mango"];
//添加在数组开头
fruits.push("Kiwi");
console.log(fruits);

//与此类似的在数组末尾添加元素可使用 pop() 方法。
lohiecan (程独秀 )- 2020-06-13 1 人
js数组unshift压栈操作
没有了
1/121 下一页