一场很很多HACK的比赛,PREtest太弱了,真的很多坑!平时练习的时候很少注意这些东西了!

A:开始一直在模拟,后来发现自己的思路逻辑很乱,果然做比赛不给力! 直接在代码中解释了

#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    int c,d,n,m,k;
    int ans=;   //初始一个值
    cin>>c>>d>>n>>m>>k;
    if (k>=n*m) cout<<<<endl;   //判断条件
    else {
            int l=m*n-k;          //出去有了的
            for (int i=;i<=l;i++)  //M枚举第二场的比赛数
           {
            int jj=(l-i+n-)/n;  //核心,计算第一场的比赛
           int yy=i*d+jj*c;       //+N-1是因为上界的原因
           ans=min(yy,ans);
        }
        cout<<ans<<endl;
    }
    return ;

}

B:一直在用自己呆板的思路做,后来居然超时了,冏!

超时代码:#include<iostream>

#include<math.h>
#include<algorithm>
#include<string.h>
#include<stdio.h>
using namespace std;
struct node
{
    int x,y,pos;
}a[];
int b[]; int cmp(node a,node b)
{
    if (a.y==b.y) return a.pos<b.pos;
    return a.y<b.y;
} int main()
{
    int n;
    scanf("%d",&n);
    for (int i=;i<=n;i++)
    {
       scanf("%d%d",&a[i].x,&a[i].y);
        a[i].pos=i;
    }
    sort(a+,a+n+,cmp);
    //for (int i=1;i<=n;i++)
   //    cout<<a[i].x<<" "<<a[i].y<<endl;
 //   a[0].x=a[1].x;
  //  a[0].y=a[1].y;
    for (int i=;i<=n;i++)
    {
        if (a[i].y!=a[i-].y)
        {
           if (a[i].x!=)
           {
              printf("NO\n");
               return ;
               }
               else {memset(b,,sizeof(b));b[]=;}
        }
        else
        {
                if (b[a[i].x-]==&&a[i].x>) { printf("NO\n");;return ;}
                else b[a[i].x]=;
            }
        }
  printf("YES\n");
   return ;

}

memset了10^5能不超吗?

发现一份神奇的处理代码,果然我弱了!

#include <iostream>
#include <map>
using namespace std;
int n,i,x,k;
bool flag=true;
int a[];
int main()
{
    cin>>n;
    for(i=;i<=;i++)
        a[i]=-;
    for(i=;i<=n;i++)
    {
        cin>>x>>k;
        if(x>a[k])
            {
            if(x>a[k]+)
            {
                flag=false;
                break;
            }
            else
                a[k]++;
        }
    }
    if(flag)
        cout<<"YES";
    else
        cout<<"NO";
    return ;

}

什么都不说了,我还做了那么多的操作,By PocolaOctavian,大神的

C:题目比较简单,构造也比较容易,1->2,1->3,1->k+1,.....n->n+k+1,形成一个圈,再判断一下

数组开小了明明有1000^2的,然后数据量大要用printf("\n");

据说很多人都跪在这里了#include<iostream>

#include<math.h>
#include<algorithm>
#include<string.h>
#include<stdio.h>
using namespace std;
int n,k;
int a[],b[];
int main()
{
  scanf("%d%d",&n,&k);
   if ((n-)/<k)
   {
      printf("-1\n");
       return ;
   }    int t=;
   for (int i=;i<=n;i++)
   {
       for (int j=;j<=k;j++)
       {
           a[++t]=i;b[t]=i+j;
           if (i+j>n) b[t]=(i+j-n);
       }
   }
   printf("%d\n",t);
   for (int i=;i<=t;i++)
   printf("%d %d\n",a[i],b[i]);
    return ;

}

RCC 2014 Warmup (Div. 2)的更多相关文章

  1. RCC 2014 Warmup (Div. 2) ABC

    题目链接 A. Elimination time limit per test:1 secondmemory limit per test:256 megabytesinput:standard in ...

  2. RCC 2014 Warmup (Div. 2) A~C

    近期CF的pretext真是一场比一场弱.第一次在CF上被卡cin.cout.... A. Elimination time limit per test 1 second memory limit ...

  3. RCC 2014 Warmup (Div. 1)

    A 暴力 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm& ...

  4. RCC 2014 Warmup (Div. 2) 蛋疼解题总结

    A. Elimination time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  5. CodeForces - 417E(随机数)

    Square Table Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit ...

  6. CodeForces - 417B (思维题)

    Crash Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status ...

  7. CodeForces - 417A(思维题)

    Elimination Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit  ...

  8. Codeforces 417 C

    Football Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Sta ...

  9. CodeForces比赛总结表

    Codeforces A                     B                        C                             D            ...

随机推荐

  1. 用delphiXE7 dbExpress Framework提供的功能获取数据表信息

    uses +  Data.DBXMetaDataNames procedure TMainForm.Button2Click(Sender: TObject);var  Cmd: TDBXComman ...

  2. SQLServer2005中查询语句的执行顺序

    SQLServer2005中查询语句的执行顺序   --1.from--2.on--3.outer(join)--4.where--5.group by--6.cube|rollup--7.havin ...

  3. SQLServer2005,2000获取表结构:字段名、类型、长度、主键、非空、注释

    SQLServer 2005 SELECT d.name N'TableName', d.xtype N'TableType', a.colorder N'ColumnIndex', a.name N ...

  4. 对于java反射的理解

    java中的反射是一种强大的工具,它能够创建灵活的代码,这些代码可以在运行时装配,无序在组件之间进行链接. 反射允许在编写与执行时,使程序代码能够接入装载到JVM的类的内部信息,而不是源代码中选定的类 ...

  5. 配置github上的SSH key及上传自己的项目到github

    这篇文章比较好,链接如下:http://www.jianshu.com/p/b81eeb5d7858 需要指出的几点:1.

  6. deep learning学习环境Theano安装(win8+win7)

    官网安装说明Installing Theano:http://deeplearning.net/software/theano/install.html#alternative-anacondace ...

  7. EMVTag系列6《IAC 发卡行行为代码》

    R(需求):数据应存在,在读应用数据过程中,终端不检查:将变成必备 L: 5 IAC 的值,最好不要自定义,最好和所选的模板完全匹配.如果修改持卡人认证位,PIN Bypass 相关的位.如果有业务需 ...

  8. DB2查询结果显示n行

    在SQLserver中语法是这样的:select top n * from staff ,即可查询显示n行数据 但是在DB2中语法是这样的,感觉比较接近英语. select * from STAFF ...

  9. JavaScript高级程序设计之寄生组合式继承

    在继承中常会出现两个问题: 父类的属性变成了子类的原型 构造器指向混乱 寄生组合式继承解决了这样的问题: 属性继承到属性 原型继承到原型 构造器指向明确 // 父类 var Super = funct ...

  10. [转]log4net 使用指南

    声明:本文内容主要译自Nauman Leghari的Using log4net,亦加入了个人的一点心得(节3.1.4). 请在这里下载示例代码 1           简介 1.1          ...