码迷,mamicode.com
首页 > 其他好文 > 详细

【Henu ACM Round #13 B】Spider Man

时间:2018-01-23 13:08:36      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:bit   txt   turn   out   spider   c++   spi   cin   sum   

【链接】 我是链接,点我呀:)
【题意】


在这里输入题意

【题解】


会发现每个环可以操作的次数是固定的。
(环的大小-1
也就是说一旦环确定了。其实结果就已经确定了。
则直接看操作总数的奇偶性就可以了。

【代码】

#include <bits/stdc++.h>
#define long long
using namespace std;

int n,x;

int main(){
    #ifdef LOCAL_DEFINE
        freopen("rush_in.txt", "r", stdin);
    #endif
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n;
    int sum = 0;
    for (int i = 1;i <= n;i++){
        cin >> x;
        sum = (sum+x-1)%2;
        if (sum==0){
            cout <<2<<endl;
        }else{
            cout <<1<<endl;
        }
    }
    return 0;
}

【Henu ACM Round #13 B】Spider Man

标签:bit   txt   turn   out   spider   c++   spi   cin   sum   

原文地址:https://www.cnblogs.com/AWCXV/p/8335061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!