构造AC的。左右两边都先不用6的倍数,然后哪边数字大那一边往回退一下,然后再比较哪边数字大.......直到结束

#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std; const int maxn = + ;
int n, m;
int a[maxn];
int b[maxn];
int flag[maxn];
int topa, topb; int main()
{
scanf("%d%d", &n, &m);
memset(a, , sizeof a);
memset(b, , sizeof b);
memset(flag, , sizeof flag);
int num1 = , num2 = , num;
int nowa = , nowb = ;
for (int aa = , i = ; aa < n; i = i + )
{
if (i % != ) a[i] = , topa = i, aa++;
else nowa = i;
}
for (int aa = , i = ; aa<m; i = i + )
{
if (i % != ) b[i] = , topb = i, aa++;
else nowb = i;
}
while ()
{
if (nowa == && nowb == ) break;
if (topa>topb)
{
a[topa] = ; topa--;
while ()
{
if (b[nowa] == )
{
a[nowa] = ;
nowa = nowa - ;
while ()
{
if (a[topa]) break;
topa--;
}
break;
}
nowa = nowa - ;
}
}
else
{
b[topb] = ; topb--;
while ()
{
if (a[nowb] == )
{
b[nowb] = ;
nowb = nowb - ;
while ()
{
if (b[topb]) break;
topb--;
}
break;
}
nowb = nowb - ;
}
}
while ()
{
if (b[nowa]) nowa = nowa - ;
else break;
}
while ()
{
if (a[nowb]) nowb = nowb - ;
else break;
}
}
printf("%d\n", max(topa, topb));
return ;
}

最新文章

  1. [转]Fiddler抓取Android真机上的HTTPS包
  2. Openstack4j 在 Maven 中的构建
  3. GOLANG 声明
  4. How To Easily Call WCF Services Properly z
  5. 《c程序设计语言》读书笔记--统计换行数,空格数,tab数
  6. setting bundle 多语言,本地化,系统设置
  7. android智能家居在线语音控制
  8. 在SQL Server 2008中调用.net,dll
  9. uploadify上传图片的类型错误的解决办法
  10. Docker- 创建支持SSH服务的容器镜像
  11. Sublime Text、webstorm等编译器快速编写HTML/CSS代码的技巧
  12. CSS布局十八般武艺都在这里了
  13. 分布式服务框架介绍:最成熟的开源NIO框架Netty
  14. jsp页面有一个注册form表单,传值的时候后台接收到的全部是null
  15. bzoj4184
  16. airflow 实战
  17. SqlServer 中的触发器
  18. spring ,springmvc的常用标签注解
  19. 1449 - The user specified as a definer(&#39;xxx&#39;@&#39;%&#39;) does not exist
  20. 链接正常但IE浏览器无法显示网页的几种情况

热门文章

  1. couldn&#39;t connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
  2. public &lt;T&gt; void method(T var)
  3. 更方便的函数回调——Lambda
  4. loadrunner多负载机联合产生负载
  5. 使用ADO对象添加、修改、删除数据
  6. PHP 常识
  7. php报错 Call to undefined function mb_stripos()
  8. Codeforces Round #272 (Div. 1) B 构造 math
  9. 使用命令将logcat中的内容输出到文本文件中
  10. 盖房子(house)