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

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

Codeforces 699 C. Vacations ( 貪心

2019-11-14 12:01:50
字體:
來源:轉載
供稿:網友
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
欧美日韩第一页| 亚洲аv电影天堂网| 久久精品91久久香蕉加勒比| 最近2019中文字幕大全第二页| 91产国在线观看动作片喷水| 久久综合电影一区| 亚洲午夜精品视频| 欧美一级淫片aaaaaaa视频| 欧美一级高清免费播放| 国产精品高潮呻吟久久av黑人| 91亚洲精品久久久久久久久久久久| 日韩三级影视基地| 日韩精品一区二区视频| 2018日韩中文字幕| 日韩在线播放av| 日本高清不卡在线| 欧美日韩国产一区在线| 国产在线观看91精品一区| 国产乱肥老妇国产一区二| 亚洲男人的天堂在线| 亚州精品天堂中文字幕| 韩国日本不卡在线| 国产福利成人在线| 中文字幕精品网| 亚洲男人av在线| 色无极亚洲影院| 中文字幕在线看视频国产欧美在线看完整| 成人黄色生活片| 亚洲人成欧美中文字幕| 亚洲午夜久久久影院| 国产一区二区在线免费视频| 欧美精品制服第一页| 91精品国产综合久久久久久久久| 欧美激情国内偷拍| 国产91精品视频在线观看| 91麻豆国产语对白在线观看| 国产精品白嫩初高中害羞小美女| 91av在线不卡| 日韩中文在线中文网在线观看| 性色av一区二区三区免费| 日韩av男人的天堂| 欧美激情精品久久久久久大尺度| 久久这里只有精品视频首页| 97香蕉久久夜色精品国产| 亚洲激情在线观看视频免费| 日韩中文字幕在线视频播放| 亚洲一区av在线播放| 欧美激情在线有限公司| 欧美成人免费网| 欧美与黑人午夜性猛交久久久| 国产午夜精品美女视频明星a级| 亚洲欧美国产另类| 欧美激情欧美激情在线五月| 国产91对白在线播放| 亚洲精品国产成人| 51ⅴ精品国产91久久久久久| 啪一啪鲁一鲁2019在线视频| 久久天天躁狠狠躁夜夜躁| 日韩视频―中文字幕| 国产精品影院在线观看| 久久久精品日本| 中文字幕不卡在线视频极品| 欧美激情在线观看| 亚洲欧美变态国产另类| 欧美在线一区二区三区四| 亚洲日本中文字幕免费在线不卡| 亚洲国产高潮在线观看| 亚洲视频在线观看免费| 欧美亚洲成人精品| 欧美成人高清视频| 欧美性一区二区三区| 亚洲成人久久久久| 91亚洲精华国产精华| 欧日韩在线观看| 日韩av电影免费观看高清| 国产精品日韩久久久久| 久久久之久亚州精品露出| 伊人伊人伊人久久| 久久精品视频播放| 欧美电影免费观看高清完整| 亚洲国产天堂久久国产91| 日韩精品高清在线观看| 国产一区香蕉久久| 国产亚洲精品久久久久动| 91精品视频大全| 久久国产精品久久国产精品| 色一区av在线| 国产精品小说在线| 亚洲欧美日韩天堂一区二区| 国产区精品在线观看| 精品一区二区三区四区| 国产精品久久久久av| 欧美另类老女人| 日韩欧美精品网址| 黑人巨大精品欧美一区免费视频| 中文欧美日本在线资源| 国产亚洲精品久久久久久牛牛| 亚洲a区在线视频| 18一19gay欧美视频网站| 日韩精品视频中文在线观看| 亚洲欧美一区二区激情| 亚洲a成v人在线观看| 成人xxxxx| 日韩精品亚洲视频| 中文字幕亚洲自拍| 亚洲精品美女久久久久| 国产午夜精品美女视频明星a级| 亚洲三级黄色在线观看| 亚洲加勒比久久88色综合| 亚洲天堂2020| 欧美性xxxx极品hd欧美风情| 国产精品免费久久久久久| 色爱精品视频一区| 九九热精品视频| 啪一啪鲁一鲁2019在线视频| 欧美大片在线影院| 国产精品成熟老女人| 日韩在线观看免费全| 欧美情侣性视频| 成人在线一区二区| 欧洲中文字幕国产精品| 日韩av在线免费播放| 久久精品视频99| 日本电影亚洲天堂| 日韩大片免费观看视频播放| 日韩欧美亚洲一二三区| 国产一区二区三区18| 日本亚洲欧美三级| 欧美激情极品视频| 97视频在线观看成人| 91免费视频网站| 国产精品一区二区久久国产| 黑人精品xxx一区一二区| 久久天天躁日日躁| 精品欧美国产一区二区三区| 国产一区视频在线| 日韩欧美成人区| 91精品国产自产在线观看永久| 57pao国产精品一区| 国产精品久久久久久久久免费| 国产精品xxxxx| 国产精品对白刺激| 欧美大尺度激情区在线播放| 欧美一级bbbbb性bbbb喷潮片| 精品成人乱色一区二区| 国产亚洲一区精品| 亚洲人成电影网站色xx| 日韩中文字幕免费| 91福利视频在线观看| 最近中文字幕日韩精品| 日韩电影中文字幕一区| 久久免费福利视频| 久久久电影免费观看完整版| 国产成人综合亚洲| 久久五月天综合| 欧美性xxxxx极品| 最新69国产成人精品视频免费| 久久久久久久久久久久久久久久久久av| 97超级碰碰人国产在线观看| 高清一区二区三区四区五区| 欧美日韩亚洲一区二区| 青青草精品毛片| 国产精品偷伦免费视频观看的| 亚洲免费视频一区二区|