亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

Codeforces 699 C. Vacations ( 貪心

2019-11-14 11:59:37
字體:
來源:轉載
供稿:網友
C. Vacationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Vasya has n days of vacations! So he decided to imPRove his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day. For the i-th day there are four options:

on this day the gym is closed and the contest is not carried out; on this day the gym is closed and the contest is carried out; on this day the gym is open and the contest is not carried out; on this day the gym is open and the contest is carried out.

On each of days Vasya can either have a rest or write the contest (if it is carried out on this day), or do sport (if the gym is open on this day).

Find the minimum number of days on which Vasya will have a rest (it means, he will not do sport and write the contest at the same time). The only limitation that Vasya has — he does not want to do the same activity on two consecutive days: it means, he will not do sport on two consecutive days, and write the contest on two consecutive days.

Input

The first line contains a positive integer n (1?≤?n?≤?100) — the number of days of Vasya’s vacations.

The second line contains the sequence of integers a1,?a2,?…,?an (0?≤?ai?≤?3) separated by space, where:

ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out; ai equals 1, if on the i-th day of vacations the gym is closed, but the contest is carried out; ai equals 2, if on the i-th day of vacations the gym is open and the contest is not carried out; ai equals 3, if on the i-th day of vacations the gym is open and the contest is carried out.Output

Print the minimum possible number of days on which Vasya will have a rest. Remember that Vasya refuses:

to do sport on any two consecutive days, to write the contest on any two consecutive days. ExamplesInput
41 3 2 0Output
2Input
71 3 3 2 1 2 3Output
0Input
22 2Output
1Note

In the first test Vasya can write the contest on the day number 1 and do sport on the day number 3. Thus, he will have a rest for only 2 days.

In the second test Vasya should write contests on days number 1, 3, 5 and 7, in other days do sport. Thus, he will not have a rest for a single day.

In the third test Vasya can do sport either on a day number 1 or number 2. He can not do sport in two days, because it will be contrary to the his limitation. Thus, he will have a rest for only one day.

題意:: 一個人在一天內有四種選擇

休息,運動||休息,工作||休息,運動||工作 工作或者運動不能連續超過兩天,求最短的休息時間 重點就是不要連續超過兩天就可以 數據比較小,暴力就可以AC了

#include<stdio.h>int arr[105];int main(){ int n; while(~scanf("%d",&n)) { for(int i = 0;i < n; i++) scanf("%d",&arr[i]); int k = 0, flag = 0; for(int i = 0;i < n; i++) { if(arr[i] == 0) { k++; flag = 0; } else if(arr[i]==1 || arr[i]==2) { if(flag == arr[i]) { k++; flag = 0; } else flag =arr[i]; } else { if(flag == 1) { flag = 2; } else if(flag == 2) { flag = 1; } } } printf("%d/n",k); }return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
一道本无吗dⅴd在线播放一区| 91精品在线播放| 亚洲娇小xxxx欧美娇小| 国内精品400部情侣激情| 亚洲最新av网址| 91爱视频在线| 成人美女av在线直播| 亚洲一区二区免费| 欧美激情网友自拍| 亚洲午夜精品视频| 日韩亚洲精品电影| 精品自在线视频| 中文字幕欧美日韩| 亚洲精品国偷自产在线99热| 国产欧美一区二区三区视频| 欧美视频一二三| 欧美日韩成人在线播放| 色偷偷av一区二区三区乱| 亚洲人成电影在线播放| 国产福利精品av综合导导航| 日韩女优人人人人射在线视频| 欧美日韩福利视频| 欧美理论在线观看| 久久99精品视频一区97| 国产不卡av在线| 欧美电影免费播放| 麻豆一区二区在线观看| 亚洲人成网站777色婷婷| 亚洲高清福利视频| 欧美亚洲一区在线| 在线视频日本亚洲性| 亚洲第一福利在线观看| 夜夜躁日日躁狠狠久久88av| 欧美高清无遮挡| 在线视频一区二区| 91免费视频网站| 欧美成年人网站| 中文字幕日韩视频| 国产成人精品最新| 欧美国产第二页| 日韩视频免费在线| 精品久久久国产精品999| 久久视频免费在线播放| 国产精品成人国产乱一区| 亚洲一区二区久久久久久久| 欧美激情一区二区三区在线视频观看| 91wwwcom在线观看| 伊人久久久久久久久久久| 在线一区二区日韩| 91中文字幕一区| 亚洲天堂影视av| 91中文字幕在线观看| 欧美色图在线视频| 国内久久久精品| 日韩一区二区久久久| 国产精品18久久久久久麻辣| www.亚洲天堂| 欧美中文字幕在线播放| 日韩精品免费在线| 久久久国产精彩视频美女艺术照福利| 日本最新高清不卡中文字幕| 亚洲精品黄网在线观看| 久久亚洲精品网站| 欧美日韩成人网| 精品国产一区二区三区四区在线观看| 亚洲自拍偷拍视频| 午夜伦理精品一区| 中国日韩欧美久久久久久久久| 色偷偷亚洲男人天堂| 精品久久久中文| 黑人极品videos精品欧美裸| 日韩美女视频在线观看| 欧美俄罗斯乱妇| 川上优av一区二区线观看| 久久男人的天堂| 久久91亚洲人成电影网站| 日韩精品免费在线视频| 中文字幕国产日韩| 色婷婷av一区二区三区久久| 91精品国产91久久久久福利| 国产精品精品视频| 成人乱人伦精品视频在线观看| 国产日韩欧美黄色| 亚洲一区亚洲二区亚洲三区| 亚洲成人精品视频在线观看| 欧美日韩在线视频观看| 欧美激情免费视频| 亚洲性线免费观看视频成熟| 丝袜情趣国产精品| 亚洲人成电影在线播放| 成人欧美一区二区三区黑人孕妇| 自拍偷拍亚洲在线| 九九九久久久久久| 国产精品入口免费视| 成人精品一区二区三区电影免费| 91成人在线播放| 性欧美xxxx| 日韩欧美aaa| 色爱av美腿丝袜综合粉嫩av| 国产精品极品美女在线观看免费| 国产精品va在线| 国产日韩欧美夫妻视频在线观看| 国产精品丝袜一区二区三区| 中文字幕亚洲欧美日韩在线不卡| 欧美激情国产精品| 一个人www欧美| 91av在线免费观看| 国产精品久久国产精品99gif| 日韩在线观看精品| 成人免费网站在线观看| 国产成人一区二区| 欧美精品免费在线| 日韩亚洲成人av在线| 91网站在线看| 欧美最猛性xxxxx亚洲精品| 精品视频—区二区三区免费| 国产精品日韩在线播放| 日韩av在线免费播放| 91av在线播放| 97超级碰碰碰久久久| 日韩欧美国产骚| 在线视频一区二区| 日韩免费黄色av| 亚洲免费一级电影| 久久躁日日躁aaaaxxxx| 亚洲一区久久久| 亚洲自拍偷拍福利| 日本久久久久久久久| 久久精品91久久香蕉加勒比| 欧美第一黄网免费网站| 丝袜美腿亚洲一区二区| 国产精品小说在线| 国产一区欧美二区三区| 亚洲人成电影在线观看天堂色| 91精品国产网站| 91精品国产91久久久久久不卡| 成人av资源在线播放| 青青a在线精品免费观看| 欧美日韩成人免费| 亚洲视频第一页| 亚洲精品自拍视频| 日韩高清欧美高清| 欧美成人免费在线视频| 欧美激情一级精品国产| 九九精品在线视频| 亚洲一区久久久| 日韩精品免费一线在线观看| 亚洲综合精品伊人久久| 午夜免费日韩视频| 日韩av手机在线观看| 日本亚洲欧洲色α| 日韩欧美有码在线| 最近2019年手机中文字幕| 国产经典一区二区| 久久亚洲精品视频| 国产精品一香蕉国产线看观看| 久久大大胆人体| 欧美日韩精品二区| 亚洲天天在线日亚洲洲精| 欧美在线观看网址综合| 成人妇女淫片aaaa视频| 欧美丝袜一区二区三区| 日韩在线观看免费全集电视剧网站| 成人两性免费视频|