***** /usr/local/run.sh 中 5 个 * 分别代表什么
答案:分钟 小时 日 月 星期几

牛客用户 进击的渣渣兔 的答案:

吃货速记:分食日月粥

Problem

time limit per test : 2 seconds
memory limit per test : 256 megabytes
input : standard input
output : standard output

Description

Alice and Bob play a game. There is a paper strip which is divided into n + 1 cells numbered from left to right starting from 0. There is a chip placed in the n-th cell (the last one).

Players take turns, Alice is first. Each player during his or her turn has to move the chip 1, 2 or k cells to the left (so, if the chip is currently in the cell i, the player can move it into cell i - 1, i - 2 or i - k). The chip should not leave the borders of the paper strip: it is impossible, for example, to move it k cells to the left if the current cell has number i < k. The player who can’t make a move loses the game.

Who wins if both participants play optimally?

Alice and Bob would like to play several games, so you should determine the winner in each game.

Input

The first line contains the single integer T (1 ≤ T ≤ 100) — the number of games. Next T lines contain one game per line. All games are independent.

Each of the next T lines contains two integers n and k (0 ≤ n ≤ 109, 3 ≤ k ≤ 109) — the length of the strip and the constant denoting the third move, respectively.

Output

For each game, print Alice if Alice wins this game and Bob otherwise.

Example

input

1
2
3
4
5
4
0 3
3 3
3 4
4 4

output

1
2
3
4
Bob
Alice
Bob
Alice

Solution

Idea

打表找规律,存在循环。

发现若 k 不为 3 的倍数,则循环节长度为 3 。若 k 为 3 的倍数, 循环节长度为 k+1, 循环节内也有一定的规律。

Problem

time limit per test : 2 seconds
memory limit per test : 256 megabytes
input : standard input
output : standard output

Description

You are given a picture consisting of $nn$ rows and $m$ columns. Rows are numbered from $1$ to $n$ from the top to the bottom, columns are numbered from $1$ to $m$ from the left to the right. Each cell is painted either black or white.

You think that this picture is not interesting enough. You consider a picture to be interesting if there is at least one cross in it. A cross is represented by a pair of numbers $x$ and $y$ , where $1≤x≤n$ and $1≤y≤m$, such that all cells in row $x$ and all cells in column $y$ are painted black.

For examples, each of these pictures contain crosses:

img

The fourth picture contains 4 crosses: at $(1,3)$ , (1,5)(1,5), $(3,3)$ and $(3,5)$ .

Following images don’t contain crosses:

img

You have a brush and a can of black paint, so you can make this picture interesting. Each minute you may choose a white cell and paint it black.

What is the minimum number of minutes you have to spend so the resulting picture contains at least one cross?

You are also asked to answer multiple independent queries.

阅读全文 »

Linux 内核源码果真精髓,相见恨晚。

offsetof 宏定义如下

1
#define offsetof(type, member) (size_t)&(((type*)0)->member)

container_of 宏定义如下

1
2
3
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})

导论

  1. 市场和市场营销定义

    从市场营销的角度看,市场就是商品交换关系的总和

    营销学中的市场:指的是具有特定的需求或欲望,而且愿意并能够通过交换来满足这种需要和欲望的全部潜在顾客。

    一般意义的市场:是商品交易的场所,是显在和潜在买主的结合体,是买卖关系的总和。

    营销是通过创造和交换产品及价值,从而使个人或组织满足欲望和需要的社会和管理过程。

    阅读全文 »

  1. What is web container ?

    Web container is the component in J2EE which is responsible for handle request from client. Web Server application like tomcat is used to support basic service for web container, e.g., receive request and forward reply to client.

    阅读全文 »

  • 全选

    普通模式下, gg 回到文件开始,v 进入可视模式, G 将光标移到文件结束。

  • 复制到系统粘贴板

    这个首先要看 vim 是否支持系统粘贴板 vim --version | grep "clipboard" 我这里 clipboard 前是 + 号,表示支持。如果是 - 号,可以百度下方法。

    普通模式下,使用 "+y 复制到粘贴板。

  • 交换相邻字符顺序

    我编程时有时因为输入太快而导致字符顺序错误。比如将 return 输入成 retrun, endl 输入成 ednl。这样子的话将光标移到出现错误的第一个字符。然后普通模式下 xp

  • 正常模式转到插入模式

    • i 当前光标前插入, I 当前行首
    • a 当前光标后插入, A 当前行尾
    • o 下一行插入, O 上一行插入
  • D: d$

  • ?:从下而上查找, / 自上而下查找

  • 保存新文件::w 路径+文件名

  • :!+bash命令:运行终端命令

  • :s/old/new:将旧的替换成新的,默认为当前行

  • :3,5s/old/new:从第 3 行到第 5 行替换

  • :s/old/new/g:全局替换

最近读《Effective C++》时读到了 new-handler 一章,了解了 new/delete 一些知识,才知道原来 new/delete 是可以个性化的。
先说简单的一个收获,C++ new 失败后默认后抛出异常,如果我们想让他失败时返回空指针,则应该使用如下写法。

1
int *pi = new (std::nothrow) int[100000000000L];

传送门:Circuit Board

Problem

Description

Arsh recently found an old rectangular circuit board that he would like to recycle. The circuit board has R rows and C columns of squares.

Each square of the circuit board has a thickness, measured in millimetres. The square in the r-th row and c-th column has thickness Vr,c. A circuit board is good if in each row, the difference between the thickest square and the least thick square is no greater than K.

Since the original circuit board might not be good, Arsh would like to find a good subcircuit board. A subcircuit board can be obtained by choosing an axis-aligned subrectangle from the original board and taking the squares in that subrectangle. Arsh would like your help in finding the number of squares in the largest good subrectangle of his original board.

阅读全文 »
0%