Armin's Blog

learn,explore,create.


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

C Looooops(拓展欧几里德)

发表于 2018-04-26 | 分类于 题解 | 阅读次数:

描述

传送门:poj-2115

A Compiler Mystery: We are given a C-language style for loop of type
for(variable = A; variable != B; variable += C)
statement;

Ie, a loop which starts by setting variable to value A and while variable is not equal to B, repeats statement followed by increasing the variable by C. We want to know how many times does the statement get executed for particular values of A, B and C, assuming that all arithmetics is calculated in a k-bit unsigned integer type (with values 0 <= x < $2^k$) modulo $2^k$.

阅读全文 »

青蛙的约会(拓展欧几里德)

发表于 2018-04-26 | 分类于 题解 | 阅读次数:

描述

传送门:poj-1061

 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。
我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样我们就得到了一条首尾相接的数轴。设青蛙A的出发点坐标是x,青蛙B的出发点坐标是y。青蛙A一次能跳m米,青蛙B一次能跳n米,两只青蛙跳一次所花费的时间相同。纬度线总长L米。现在要你求出它们跳了几次以后才会碰面。

阅读全文 »

Who Gets the Most Candies?(线段树+约瑟夫环)

发表于 2018-04-25 | 分类于 题解 | 阅读次数:

描述

传送门:poj-2886

 N children are sitting in a circle to play a game.

The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The game starts from the K-th child, who tells all the others the integer on his card and jumps out of the circle. The integer on his card tells the next child to jump out. Let A denote the integer. If A is positive, the next child will be the A-th child to the left. If A is negative, the next child will be the (−A)-th child to the right.

The game lasts until all children have jumped out of the circle. During the game, the p-th child jumping out will get F(p) candies where F(p) is the number of positive integers that perfectly divide p. Who gets the most candies?

阅读全文 »

Minimum Inversion Number(树状数组+离散化处理)

发表于 2018-04-24 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-1394

 The inversion number of a given number sequence $a_1, a_2, …, a_n$ is the number of pairs $(a_i, a_j)$ that satisfy i < j and $a_i > a_j$.

For a given sequence of numbers a1, a2, …, an, if we move the first m >= 0 numbers to the end of the seqence, we will obtain another sequence. There are totally n such sequences as the following:

阅读全文 »

Billboard(线段树)

发表于 2018-04-22 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-2795

 At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are posted: nearest programming competitions, changes in the dining room menu, and other important information.

阅读全文 »

swust oj(数据结构前40)

发表于 2018-04-14 | 分类于 题解 | 阅读次数:

博主码风太丑,勿喷。
由于据说数据结构考试必须强行用学的这些数据结构,所以都老老实实写的。用数组模拟的代码有时间再写了

有的题数据输出格式改了,PE的题请在下面评论区留言。不懂的也可以在下面留言,可能会解答。
数据结构后40

阅读全文 »

尔尔序的神奇计数问题(set容器)

发表于 2018-04-10 | 分类于 题解 | 阅读次数:

描述

传送门:swustoj-2612

  现在有4个集合,分别为$A,B,C,D$,且每一个集合的大小都是n。尔尔序想求解一个问题,现在他把$A,B,C$的交集的大小、$A,B,D$的交集的大小,$A,C,D$的交集的大小,$B,C,D$的交集的大小之和记为$X$,同时把$A,B$的交集的大小、$A,C$的交集的大小、$A,D$的交集的大小、$B,C$的交集的大小、$B,D$的交集的大小之和记为Y,求解$|X−Y|$的值。

阅读全文 »

邂逅明下(巴什博弈变形)

发表于 2018-04-09 | 分类于 题解 | 阅读次数:

描述

传送门:hdu-2897

 当日遇到月,于是有了明。当我遇到了你,便成了侣。
那天,日月相会,我见到了你。而且,大地失去了光辉,你我是否成侣?这注定是个凄美的故事。
 小t和所有世俗的人们一样,期待那百年难遇的日食。驻足街头看天,看日月渐渐走近,小t的脖子那个酸呀(他坚持这个姿势已经有半个多小时啦)。他低下仰起的头,环顾四周。忽然发现身边竟站着位漂亮的mm。天渐渐暗下,这mm在这街头竟然如此耀眼,她是天使吗?站在小t身边的天使。

阅读全文 »

One Person Game(拓展欧几里德算法)

发表于 2018-04-09 | 分类于 题解 | 阅读次数:

描述

传送门:zoj-3593

 There is an interesting and simple one person game. Suppose there is a number axis under your feet. You are at point $A$ at first and your aim is point $B$. There are 6 kinds of operations you can perform in one step. That is to go left or right by $a,b$ and $c$, here $c$ always equals to $a+b$.

You must arrive B as soon as possible. Please calculate the minimum number of steps.

阅读全文 »

博弈笔记本

发表于 2018-03-30 | 分类于 学习笔记 | 阅读次数:

博弈好难啊啊啊啊啊啊…

阅读全文 »
1…5678
Armin

Armin

梦里不知身是客,一晌贪欢

80 日志
5 分类
53 标签
GitHub Weibo E-Mail Facebook Twitter
友情链接
  • Phantaci
  • Angora
  • VoidR
  • fjk
  • Chengshao
  • Nico
© 2019 Armin
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4
人 次