首页 > TAG信息列表 > fridge

对象添加迭代器

  当需要对一个对象进行迭代时(比如用于一个for..of循环中),它的@@iterator方法都会在不传参情况下被调用,返回的迭代器用于获取要迭代的值。   let fridge = { name: "卡萨帝冰箱", color: "白色", brand: "海尔" };fridge[Symbol.iterator] = function*() { yield this.name; yi

B. Alyona and a Narrow Fridge 【 思维题 】

B. Alyona and a Narrow Fridge Codeforces Global Round 2 &:这题看到了一种很简单的做法,于是按照敲一波,比原来打的好看多了。 题意:给你一个 h * 2 的冰箱,然后给你一些随机高度 A * 1的瓶子 ,一个高的瓶子一旦放上,那么这一段就不能发其他的了,但是旁边的一个单位宽度依然可以放

Codeforces Global Round 2

本来想一场上紫;真没想到结果集体凉凉 A. Ilya and a Colorful Walk Ilya lives in a beautiful city of Chordalsk. There are nn houses on the street Ilya lives, they are numerated from 11 to nn from left to right; the distance between every two neighboring h