博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #211 (Div. 2)
阅读量:4567 次
发布时间:2019-06-08

本文共 1911 字,大约阅读时间需要 6 分钟。

难得一次比赛能够自己成功A掉四个题;

A题:水题,模拟一下就行;

1 #include 
2 #include
3 using namespace std; 4 5 void print(int x) 6 { 7 if(x>=5){printf("-O|");x%=5;} 8 else printf("O-|"); 9 if(x==0)puts("-OOOO");10 else if(x==1)puts("O-OOO");11 else if(x==2)puts("OO-OO");12 else if(x==3)puts("OOO-O");13 else if(x==4)puts("OOOO-");14 }15 16 int n;17 int main()18 {19 scanf("%d",&n);20 while(n/10>0)21 {22 int x=n%10;23 print(x);24 n/=10;25 }26 print(n);27 return 0;28 }
View Code

B:水题,边输入边统计就行:

1 By yours1103, contest: Codeforces Round #211 (Div. 2), problem: (B) Fence, Accepted, # 2  #include 
3 #include
4 #define maxn 150005 5 using namespace std; 6 7 int n,k,ans,num[maxn],tt,mi; 8 int main() 9 {10 scanf("%d%d",&n,&k);11 tt=k-1;12 for(int i=0; i
View Code

C:水题,对于连续的数量大于1的字符,最好的情况是212121····

1 #include
2 #include
3 #define maxn 200009 4 using namespace std; 5 6 char s[maxn],t[maxn]; 7 int co[maxn]; 8 int cnt,num; 9 10 int main()11 {12 scanf("%s",s);13 int l=strlen(s);14 t[cnt]=s[0];15 num=1;16 for(int i=1;i
View Code

D:二分+贪心的题。挺简单的

1 #include
2 #include
3 #include
4 #define maxn 100005 5 using namespace std; 6 7 int p[maxn],v[maxn],a; 8 int n,m; 9 bool vis[maxn];10 bool ok(int x)11 {12 int tmp=a;13 int cnt=1;14 memset(vis,0,sizeof vis);15 for(int i=x-1;i>=0;i--)16 {17 if(p[n-cnt]
>1;37 if(ok(mid))l=mid+1;38 else r=mid-1;39 }40 int sum=0,tt;41 for(int i=0;i
a)tt=sum-a;44 else tt=0;45 printf("%d %d\n",r,tt);46 return 0;47 }
View Code

 

转载于:https://www.cnblogs.com/yours1103/p/3419869.html

你可能感兴趣的文章
React开发
查看>>
权限管理
查看>>
Python字符串操作
查看>>
连接池
查看>>
使用易语言COM对象取文件版本
查看>>
3、将uboot,kernel,rootfs下载到开发板上
查看>>
2.16.10.init进程详解1
查看>>
对redis深入理解
查看>>
centos7 install idea and x-windows
查看>>
Spring Boot + Spring Cloud 构建微服务系统(九):配置中心(Spring Cloud Config)
查看>>
【转】LINQ to SQL语句(1)之Where
查看>>
《基于MVC的javascript web富应用开发》中的一些函数
查看>>
python爬虫抓取哈尔滨天气信息(静态爬虫)
查看>>
0014---简单的计算
查看>>
假期周进度报告6
查看>>
自己写的文字轮播(简陋版)
查看>>
TWaver在FTTX设备网管系统中的应用
查看>>
python入门笔记1
查看>>
【转】Ext JS xtype
查看>>
Word打不开老提示进入“安全模式”怎么办
查看>>