1. 程式人生 > >Switch Game HDU

Switch Game HDU

題目:

There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the condition ( on to off and off to on ). InputEach test case contains only a number n ( 0< n<= 10^5) in a line. 
OutputOutput the condition of the n-th lamp after infinity operations ( 0 - off, 1 - on ). Sample Input
1
5
Sample Output
1
0

程式碼:

#include<iostream>
#include<math.h>
using namespace std;

int main()
{
	int a;
	while (cin >> a)cout << (int(sqrt(a))*int(sqrt(a)) == a) <<
endl; return 0; }

相關推薦

Switch Game HDU

題目: There are many lamps in a line. All of them are off at first. A series of operations are carri

杭電(hdu)2053 Switch Game 水題

center ++ class chang names top weight ext == Switch Game Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J

HDU 2053 - Switch Game (開燈問題)

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21842 

HDU 2053 Switch Game(開燈問題,唯一分解定理)

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15011    Accepted S

hdu 2051 Switch Game(模擬/數論)

題目意思: 給你n個燈,剛開始全滅,問經過無窮多次操作後,求第n個燈的狀態。 題目分析: 見程式碼註釋。 AC程式碼: /** *@xiaoran *應該是數論問題,先模擬看看(過了),

Multiply game HDU-3074

chan std for each cat sequence isp oid cti upd Multiply game Tired of playing computer games, alpc23 is planning to play a game on numb

A simple stone game HDU - 2486

文章目錄 A simple stone game HDU - 2486 題意: 解法: A simple stone game HDU - 2486 題意: 一堆石子有n個,兩個人輪流取,不能取的人輸。規則如

Calendar Game HDU - 1079

Adam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they played the Calendar Game, in celebration of this contes

Game HDU - 3657(最小割)

Game Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1563   &nb

博弈論—NP圖法kiki's game HDU

題解:這一題用NP圖來進行求解,分別畫出 偶X奇,偶X偶,奇X奇的矩陣來找出規律來即可求出結果。 NP圖的畫法: 以下內容為借鑑,因為寫的很好,沒啥要補充的。 博弈論:組合博弈 * 必敗點(P點) :前一個選手(Previous player)將取勝的位置稱為

Mr. Frog’s Game HDU

分類:搜尋 2018TYUT秋季ACM模擬賽(14)2016CCPC東北地區 題意:連連看,問給出的局面中是否可以消去一對。 思路:邊界消得情況,裡面兩個相連消得情況,分類看一下,找到變break輸出  #include<iostream> #incl

暑假訓練 City Game HDU

題目描述: Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is

Multiply game HDU

題解 給n個數字 兩種操作一種將某個點修改為某個值 另一種詢問一個區間的所有元素乘積 線段樹模板提 單點修改區間查詢 AC程式碼 #include <stdio.h> #include <bits/stdc++.h> using name

A Simple Stone Game HDU

After he has learned how to play Nim game, Bob begins to try another stone game which seems much easier.  The game goes like this: one pla

ACM水題堆(一)T-switch game

There are many lamps in a line. All of them are off at first. A series of operations are carried out

Game HDU - 3389

++ cstring tput vector namespace second signed opened max Bob and Alice are playing a new game. There are n boxes which have been numbere

Switch Game :因子數

inpu targe int tput ble ons there tom ide A - Switch Game Problem Description There are many lamps in a line. All of them are off at fi

HDU 3435A new Graph Game(網絡流之最小費用流)

new ext 感覺 span hdu string.h return pri cpp 題目地址:HDU 3435 這題剛上來一看,感覺毫無頭緒。。再細致想想。。發現跟我做的前兩道費用流的題是差點兒相同的。能夠往那上面轉換。 建圖基本差點兒相同。僅僅只是這裏是無向圖。建

hdu 5975---Aninteresting game(樹狀數組)

owb form target pla rst phy ace empty creat 題目鏈接 Problem Description Let’s play a game.We add numbers 1,2...n in increasing or

HDU 5299 Circles Game

bob ive memset sea total one dsm bottom 全部 轉化為樹的刪邊遊戲。。。 樹的刪邊遊戲 規則例如以下:  給出一個有 N 個點的樹,有一個點作為樹的根節點。  遊戲者輪流從樹中刪去邊,刪去