题意:给定 n 个数,表示不同的环,然后把环拆成全是1,每次只能拆成两个,问你有多少次。

析:也不难,反正都要变成1,所以把所有的数都减1,再求和即可。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
using namespace std ; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1e4 + 5;
const int mod = 1e9 + 7;
const int dr[] = {0, 0, -1, 1};
const int dc[] = {-1, 1, 0, 0};
int n, m;
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
cin >> n;
LL sum = 0;
for(int i = 0; i < n; ++i){
scanf("%d", &m);
sum += (LL)(m-1);
if(sum & 1) printf("1\n");
else printf("2\n");
}
return 0;
}

CodeForces 705B Spider Man (水题)的更多相关文章

  1. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  2. CodeForces 705B Spider Man

    水题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #includ ...

  3. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  4. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  6. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  7. CodeForces 534B Covered Path (水题)

    题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...

  8. Codeforces Gym 100286I iSharp 水题

    Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  9. CodeForces 705A(训练水题)

    题目链接:http://codeforces.com/problemset/problem/705/A 从第三个输出中可看出规律, I hate that I love that I hate it ...

随机推荐

  1. AWS 之 S3篇<.NET(c#)批量上传文件>

    第一次知道AWS然后网上就研究了一番,如果也是第一次知道这个的话,或者对这个只知道是干什么,并没有写个相关的程序的话,可以看看这个网址http://docs.aws.amazon.com/zh_cn/ ...

  2. WebService只能在本地使用,无法通过网络访问的解决办法

    问题描述:WebService只能在本地使用,无法通过网络访问. 解决方案:在web.config的<system.web></system.web>中间加入如下配置节内容: ...

  3. LA 4119 (差分数列 多项式) Always an integer

    题意: 给出一个形如(P)/D的多项式,其中P是n的整系数多项式,D为整数. 问是否对于所有的正整数n,该多项式的值都是整数. 分析: 可以用数学归纳法证明,若P(n)是k次多项式,则P(n+1) - ...

  4. lrj计算几何模板

    整理了一下大白书上的计算几何模板. #include <cstdio> #include <algorithm> #include <cmath> #include ...

  5. HDU 1280 前m大的数【哈希入门】

    题意:中文的题目= =将各种组合可能得到的和作为下标,然后因为不同组合得到的和可能是一样的, 所以再用一个数组num[]数组,就可以将相同的和都记录下来 #include<iostream> ...

  6. [转:CSS3-前端] CSS3发光和多种图片处理

    原文链接:http://www.qianduan.net/css3-image-styles.html 一些上流的CSS3图片样式 神飞 发表于 24. Sep, 2011, 分类: CSS , 46 ...

  7. LintCode: isSubTree

    Title: 有两个不同大小的二进制树: T1 有上百万的节点: T2 有好几百的节点.请设计一种算法,判定 T2 是否为 T1的子树 class Solution { public: /** * @ ...

  8. BUFFER CACHE之主要的等待事件

    原因:资源紧张,等待其释放. 原因的原因:1. lgwr和DBWn进程写太慢:2. Buffer和latch不可用 原因的原因的原因:全表扫描.library cache latches数太多等. 视 ...

  9. 《C++ Primer 4th》读书笔记 第9章-顺序容器

    原创文章,转载请注明出处:http://www.cnblogs.com/DayByDay/p/3936460.html

  10. C#中的lock关键字

    前几天与同事激烈讨论了一下,有一点收获,记录起来. 首先给出MSDN的定义: lock 关键字可以用来确保代码块完成运行,而不会被其他线程中断.这是通过在代码块运行期间为给定对象获取互斥锁来实现的. ...