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

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

Codeforces 699 C. Vacations ( 貪心

2019-11-14 12:56:45
字體:
來源:轉載
供稿:網友
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
国产精品h片在线播放| 欧美日韩在线观看视频| 最新69国产成人精品视频免费| 国产精品吹潮在线观看| 久久免费视频网站| 日韩av网站大全| 日韩av免费在线播放| 美女视频久久黄| 91久久在线视频| 国产专区欧美专区| 国产成一区二区| 91精品国产综合久久香蕉| 69视频在线播放| 国产成人午夜视频网址| 国产成人精品av| 欧美精品999| 中文字幕久久精品| 狠狠久久亚洲欧美专区| 国产亚洲精品久久久| 992tv成人免费视频| 黑人极品videos精品欧美裸| 亚洲第一精品久久忘忧草社区| 亚洲免费视频一区二区| 亚洲欧美资源在线| 91精品在线播放| 日韩精品在线看| 亚洲高清免费观看高清完整版| 国产女人18毛片水18精品| 国产啪精品视频| 日韩在线观看精品| 97久久精品视频| 国产欧美久久一区二区| 亚洲男女性事视频| 色噜噜狠狠狠综合曰曰曰88av| 国产日韩综合一区二区性色av| 国产福利精品视频| 国产一区欧美二区三区| 国内精品一区二区三区四区| 久久精品久久精品亚洲人| 91香蕉嫩草神马影院在线观看| 国产香蕉精品视频一区二区三区| 国产一区视频在线| 日韩精品免费观看| 亚洲人成五月天| 国产精品偷伦视频免费观看国产| 久久99久久99精品中文字幕| 日韩在线精品视频| 在线播放日韩专区| 日韩av电影免费观看高清| 8050国产精品久久久久久| 国产精品影片在线观看| 日韩欧美在线视频观看| 国产成人一区二区在线| 国产欧美婷婷中文| 日韩av电影免费观看高清| 热久久这里只有精品| 日韩av免费一区| 成人性生交大片免费观看嘿嘿视频| 中文字幕一区二区精品| 亚洲第一精品福利| 国产精品高清在线| 国产女人精品视频| 国产精品第3页| 国产亚洲欧美日韩精品| 亚洲永久免费观看| 97视频免费看| 久久久噜噜噜久久久| 精品呦交小u女在线| 欧美另类在线观看| 岛国精品视频在线播放| 国产精品自拍视频| 91精品成人久久| 国内免费久久久久久久久久久| 欧美国产日韩一区二区| 亚洲欧美日韩中文视频| 在线午夜精品自拍| 成人免费视频97| 91av视频在线观看| 久久亚洲精品一区二区| 国产精品自拍小视频| 欧美乱大交xxxxx另类电影| 91亚洲人电影| 欧美激情精品久久久久久黑人| 在线播放日韩av| 尤物yw午夜国产精品视频| 国产主播喷水一区二区| 国产精品一区二区三| 日韩精品高清视频| 亚洲国产天堂久久综合| 日韩影视在线观看| 国产精品久久久久久久久影视| 777精品视频| 欧美风情在线观看| 欧美电影电视剧在线观看| 精品成人国产在线观看男人呻吟| 911国产网站尤物在线观看| 久久久久成人网| 欧美日韩中文字幕在线| 久久久视频精品| 成人av色在线观看| 久久九九精品99国产精品| 国产精品av网站| 国产精品永久免费观看| 91黑丝高跟在线| 亚洲欧洲日产国码av系列天堂| 这里只有精品久久| 亚洲国产精品人久久电影| www.欧美三级电影.com| 欧美国产欧美亚洲国产日韩mv天天看完整| 成人情趣片在线观看免费| 欧美性高跟鞋xxxxhd| 日韩电影中文字幕在线| 欧美孕妇毛茸茸xxxx| 精品日本美女福利在线观看| 亚洲视频一区二区| 久久久久久久久久久成人| 91精品国产高清久久久久久| 欧美成人三级视频网站| 久久久精品影院| 亚洲最大的成人网| 在线不卡国产精品| 伦伦影院午夜日韩欧美限制| 欧美激情一级欧美精品| 日韩中文字幕欧美| 欧美孕妇性xx| 国产精品免费看久久久香蕉| 久久久久久国产精品三级玉女聊斋| 亚洲视频国产视频| 国产一区二区欧美日韩| 色综合久久久久久中文网| 亚洲欧美三级在线| 91国产精品91| 国产伦精品一区二区三区精品视频| 国产精品久久久久久久久久久久| 日韩禁在线播放| 中文字幕无线精品亚洲乱码一区| 欧美成人精品三级在线观看| 91精品国产乱码久久久久久久久| 欧美综合国产精品久久丁香| 91在线免费网站| 日韩国产欧美区| 中文字幕久热精品视频在线| 久久久久久久久久久成人| 亚洲一区国产精品| 日韩毛片在线观看| 日韩视频欧美视频| 亚洲日本中文字幕免费在线不卡| 国外成人性视频| 国产福利精品视频| 国产日韩换脸av一区在线观看| 成人国产精品色哟哟| 中文字幕国产亚洲2019| 国产精品毛片a∨一区二区三区|国| 69av视频在线播放| 欧美日韩综合视频| 国产91色在线|| 高清日韩电视剧大全免费播放在线观看| 成人网址在线观看| 亚洲综合在线做性| 色婷婷久久一区二区| 日本欧美中文字幕| 国产精品色视频| 欧美大尺度激情区在线播放| 色先锋久久影院av|