UVa Problem Solution: 10110 - Light, More Light
来源:互联网 发布:java转ansi utf-8 编辑:程序博客网 时间:2024/05/18 11:25
The final state of the last bulb is determined by the number of factors of n. Only the number which is the square of a number has an odd number of factors, thus it has a state of "yes".
Code:
- /***************************************************************************
- * Copyright (C) 2008 by Liu Kaipeng *
- * LiuKaipeng at gmail dot com *
- ***************************************************************************/
- /* @JUDGE_ID 00000 10110 C++ "Light, More Light" */
- #include <algorithm>
- #include <cmath>
- #include <cstdio>
- #include <cstring>
- #include <deque>
- #include <fstream>
- #include <iostream>
- #include <list>
- #include <map>
- #include <queue>
- #include <set>
- #include <stack>
- #include <string>
- #include <vector>
- using namespace std;
- int main(int argc, char *argv[])
- {
- #ifndef ONLINE_JUDGE
- freopen((string(argv[0]) + ".in").c_str(), "r", stdin);
- freopen((string(argv[0]) + ".out").c_str(), "w", stdout);
- #endif
- /* The final state of the last bulb is determined by the number of factors
- of n. Only the number which is the square of a number has odd number of
- factors, thus it has a state of "yes". */
- for (unsigned int n; cin >> n && n != 0; ) {
- unsigned int r = sqrt(n);
- if (r * r == n) cout << "yes/n";
- else cout << "no/n";
- }
- return 0;
- }
- UVa Problem Solution: 10110 - Light, More Light
- uva 10110 Light, more light
- uva 10110 - Light, more light
- uva 10110 - Light, more light
- UVa 10110 Light, more light
- UVa 10110 - Light, more light
- UVa 10110-Light, more light
- UVa 10110 - Light, more light
- UVa 10110: Light, more light
- UVA 10110 Light, more light
- uva 10110 - Light, more light
- uva 10110 Light, more light
- UVa 10110 - Light, more light
- UVa 10110 - Light, more light
- uva 10110 - Light, more light
- UVa 10110 - Light, more light
- UVa 10110 Light, more light
- UVA 10110 Light, more light
- Linux makefile 教程
- 世界上最神奇的数字是:142857
- 图像旋转原理和旋转公式
- 一个大学生的感慨:从招聘看中国软件业
- yum插件axelget
- UVa Problem Solution: 10110 - Light, More Light
- 保证能让你乐的小笑话
- 什么是智能卡与IC卡
- GridLayout的几种常用设置
- java一面试题解析:Java中默认的行字排序方式是什么?
- 优酷为什么封百度?
- JDK
- 【笑话一个】一个北大女生给男友的道歉信(果然不愧是北大的学生)
- 使用javascript来编写动态Html