题目链接:1.3.4

为了防止有重复的数字,我开了个三维数组来标记,爆内存,又用vector标记,爆内存...

不得不感慨这份代码.

/*
ID:wang9621
PROG:combo
LANG:C++
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
int n;
bool close(int a,int b)
{
if(abs(a-b)<=||abs(a-b)>=(n-)) return true;
return false;
}
bool judge(int m1,int m2,int m3,int n1,int n2,int n3)
{
return close(m1,n1)&&close(m2,n2)&&close(m3,n3);
}
int main()
{
freopen("combo.in","r",stdin);
freopen("combo.out","w",stdout);
scanf("%d",&n);
int a,b,c;
int e,f,g;
cin>>a>>b>>c;
cin>>e>>f>>g;
int count = ;
for(int i = ; i<=n; i++)
for(int j = ; j<=n; j++)
for(int k = ; k<=n; k++)
if(judge(i,j,k,a,b,c)||
judge(i,j,k,e,f,g))
count++;
printf("%d\n",count);
return ;
}

USACO1.3.4 Combination Lock的更多相关文章

  1. 洛谷 P2693 [USACO1.3]号码锁 Combination Lock

    P2693 [USACO1.3]号码锁 Combination Lock 题目描述 农夫约翰的奶牛不停地从他的农场中逃出来,导致了很多损害.为了防止它们再逃出来,他买了一只很大的号码锁以防止奶牛们打开 ...

  2. Combination Lock

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Micr ...

  3. hihocoder #1058 Combination Lock

    传送门 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a ...

  4. 贪心 Codeforces Round #301 (Div. 2) A. Combination Lock

    题目传送门 /* 贪心水题:累加到目标数字的距离,两头找取最小值 */ #include <cstdio> #include <iostream> #include <a ...

  5. Codeforces Round #301 (Div. 2) A. Combination Lock 暴力

    A. Combination Lock Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/540/p ...

  6. Hiho----微软笔试题《Combination Lock》

    Combination Lock 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You ...

  7. CF #301 A :Combination Lock(简单循环)

    A :Combination Lock 题意就是有一个密码箱,密码是n位数,现在有一个当前箱子上显示密码A和正确密码B,求有A到B一共至少需要滚动几次: 简单循环:

  8. hihocoder-第六十一周 Combination Lock

    题目1 : Combination Lock 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview roo ...

  9. A - Combination Lock

    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description Scroog ...

随机推荐

  1. LR的VG与Control之间的关系,并发的实质

    LR的VG与Control之间的关系,经过无数次的实验,搞清楚了现实意义的并发.传说每秒有几百,几千,几万用户并发,基本属于设想状态. 在一秒内处理多少个请求,完全在于服务器处理能力的强弱.这里需要强 ...

  2. apache启动报错:Cannot load php5apache2_2.dll into server

    错误信息: httpd.exe: Syntax error on line 178 of D:/Program Files/httpd-2.4.20-x64-vc14-r2 /Apache24/con ...

  3. sql语句操作表

    "create table mytable (m_id integer identity(1,1) primary key,m_class varchar(50) not null defa ...

  4. 【jsp/servlet】 javaweb中的一些简单问题整理

    1 jsp工作原理 答: 动态网页技术标准blabla...jsp程序的工作方式为请求/响应模式,客户端发出http请求,jsp程序收到请求后进行处理,并返回处理的结果. jsp程序需要运行在特定的w ...

  5. 事件委托小demo(原生版)

    <style type="text/css"> body, div, span { margin:; padding:; font-family: "\5FA ...

  6. Arrays类与Array类探究

    这里所说的Arrays类是util包中的java.util.Arrays,Array是反射包中的java.lang.reflect.Array. 首先介绍Arrays类的常用的静态方法: 1.排序方法 ...

  7. 配置App真机测试证书的流程 一览

    原文链接:http://www.jianshu.com/p/6b0de0d4c925 有开发者账号的前提下, 请进行如下步骤:1.首先登录网站:https://developer.apple.com. ...

  8. OC 消息机制本质

    转载自:http://m.blog.csdn.net/blog/util_c/10287909 在Objective-C中,message与方法的真正实现是在执行阶段绑定的,而非编译阶段.编译器会将消 ...

  9. [转]View属性 之 paddingStart & paddingEnd

    [CAUSE] 在写一个自定义View时, 直接复制了Android-Source的XML布局文件, 默认开发SDK版本是4.2.2(Level-API-17), 后因其他原因将SDK版本改为4.1. ...

  10. android 原生的DownloadManager

    代码: public class MainActivity extends Activity { private DownloadManager downloadManager; public sta ...