最新 最热

按需取余

You are given three integers x,y and n. Your task is to find the maximum integer k such that 0≤k≤n that kmodx=y, where mod is modulo operation. Many programming...

2020-07-27
1

ISO C forbids comparison between pointer and integer [-fpermissive]

异常:ISO C forbids comparison between pointer and integer [-fpermissive] 意思是:指针和整数比较出错;禁止指针和整数进行比较。 S[i]是字符,”#”表示一个字符串的首地址。...

2020-07-23
1

PAT1045 Favorite Color Stripe (30分) 动态规划

Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwant...

2020-07-14
1

PAT 1046 Shortest Distance (20分)

The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.

2020-07-14
1

组队和公会系统的功能实现

服务器队伍类,组队数据仅在内存中使用,如果做成支付宝种树,叠猫猫那类持久组队,可以新建张数据表

2020-07-10
0

java多线程之Phaser

前面的文章中我们讲到了CyclicBarrier、CountDownLatch的使用,这里再回顾一下CountDownLatch主要用在一个线程等待多个线程执行完毕的情况,而CyclicBarrier用在多个线程互相等待执行完毕的情况。...

2020-07-08
1

「R」魔性的ggplot2,多个图例时顺序会变?

如果我们要改变图例顺序,按下面的操作,将color变成1,然后fill使用默认排序:

2020-07-02
1

C++核心准则ES.106:不要试图通过使用无符号类型避免负值

Choosing unsigned implies many changes to the usual behavior of integers, including modulo arithmetic, can suppress warnings related to overflow, and opens the ...

2020-06-24
1

C++核心准则ES.103​:防止溢出​

Overflow usually makes your numeric algorithm meaningless. Incrementing a value beyond a maximum value can lead to memory corruption and undefined behavior.

2020-06-17
1

常用阻塞队列 BlockingQueue 有哪些?

之前,介绍了一下 ThreadPoolExecutor 的各参数的含义(并发编程之线程池ThreadPoolExecutor),其中有一个 BlockingQueue,它是一个阻塞队列。那么,小伙伴们有没有想过,为什么此处的线程池要用阻塞队列呢?...

2020-06-16
1