319. Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s
There are n bulbs that are initially off. You first turn on all >the bulbs. Then, you turn off every second bulb. On the >third round, you toggle every third bulb (turning on if it’s >off or turning
比赛链接:http://codeforces.com/contest/577 A. Multiplication Table time limit per test:1 second memory limit per test:256 megabytes Let's consider a table consisting of n rows and
1、题目描述 初始时有 n 个灯泡处于关闭状态。第一轮,你将会打开所有灯泡。接下来的第二轮,你将会每两个灯泡关闭一个。 第三轮,你每三个灯泡就切换一个灯泡的开关(即,打开变关闭,关闭变打开)。第 i 轮,你每 i 个灯泡就切换一个灯泡的开关。直到第 n 轮,你只需要切换最后一个灯泡的开关。 找出并返回 n 轮后有多少个亮着的灯泡。 2、算法分析 1、常规方法: 定义一个boolea
C. Points on Plane 题目连接 http://codeforces.com/contest/576/problem/C Description On a plane are n points (xi, yi) with integer coordinates between 0 and 10
翻译 这儿有n个灯泡被初始化。首先,你点亮所有的灯泡。然后,你关掉每第二个灯泡。在第三回,你切换每第三个灯泡(如果它是关闭的则开启它,如果它是开启的则关闭它)。对于第i回,你切换每第i个灯泡。对于第n回,你仅仅切换最后一个灯泡。找出在n回之后还有多少个灯泡是亮着的。 原文 There are n bulbs that are initially off. You first turn on
Description There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or
Description There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or