atcoder ABC 359-B题详解 Problem Statement There are 2N people standing in a row, and the person at the i-th position from the left is wearing clothes of color Ai. Here, the clothes have N colors from 1
atcoder ABC 359-A题详解 Problem Statement You are given N strings. The i-th string Si(1≤i≤N) is either Takahashi or Aoki. How many i are there such that Si is equal to Takahashi? Constraints 1≤N≤10
题意 AtCoder ABC 365G Freestyle 题解 考虑任两种操作 ( A i , B i ) (A_{i},B_{i}) (Ai,Bi)和 ( A j , B j ) (A_{j},B_{j}) (Aj,Bj),则他们的任意组合可以表示为 ( t A i + ( 1 − t ) A j , t B i + ( 1 − t ) B j ) \big(tA_{i}+(1-
atcoder ABC 358-B题详解 Problem Statement At the entrance of AtCoder Land, there is a single ticket booth where visitors line up to purchase tickets one by one. The purchasing process takes A seconds p
atcoder ABC 357-C题详解 Problem Statement For a non-negative integer K, we define a level-Kcarpet as follows: A level-0 carpet is a 1×1 grid consisting of a single black cell. For K>0, a level-K carp
link 其实是我之前写的一篇博客的推广 大意: 一个阶梯型,第 i i i行有 ⌈ i / 2 ⌉ ∗ 2 \left \lceil i/2 \right \rceil*2 ⌈i/2⌉∗2个方块,总共有n行。在其中给定 m m m个点无法经过,求从左上角到右下角的方案数。其中每次移动只能向右或向下 N ≤ 2.5 e 5 , M ≤ 50 N\leq 2.5e5,M\leq 50 N≤2.5
A - Partition Problem Statement You are given integers N N N and K K K. The cumulative sums of an integer sequence X = ( X 1 , X 2 , … , X N ) X=(X_1,X_2,\dots ,X_N) X=(X1,X2,…,XN) of length
1、wait notify 版 public class SyncWaitNotify {//打印标识:1打印a,2打印b,3打印cprivate int flag;//每个字母的打印次数private int loopNumber;//构造方法public SyncWaitNotify(int flag, int loopNumber) {this.flag = flag;this.loopN
今天来练习一下synchronized 简单来利用synchronized实现一个字符串的交替打印 主要的实现设置一个全局的变量state,线程执行通过不断累加state,根据state对三取余的结果来判断该线程是否继续执行还是进入等待。并通过synchronized锁住一个共享变量lock来进行上锁。 最后创建三个线程并让其进入就绪态。 代码实现: public class Test
输入描述 abc 输出描述 a b c ab ac bc abc class Main38{private static ArrayList<String> permutation(String str){ArrayList<String> list = new ArrayList<>();if (str == null || str.length() == 0)return