一场很很多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. S5PV2210

    http://www.doc88.com/p-773451739254.html CAN转换器 CAN总线信息转换输出装置 基于车载CAN总线的倒车雷达单元设计[图] http://www.doc88 ...

  2. asp.net mvc razor html encoding

    HTML Encoding 为了跨站点的脚本攻击,Razor 语法会直接将脚本代码编码输出. @{string message = "<script>alert('haacked ...

  3. jQuery学习笔记(1)

    设置和获取HTML,文本和值 val()方法: 1.单选框 <html xmlns="http://www.w3.org/1999/xhtml"> <head r ...

  4. ok6410串口裸机总结

    1.串口角色:(1)数据传输通道(2)控制台 2.通讯参数(1)波特率:衡量传输速率的快慢,每秒钟传输数据的位数(bit)(2)数据位:有效数据(3)起始位:线路空闲的时候是高电平,当检测到低电平认为 ...

  5. 第七章 管理类型(In .net4.5) 之 使用类型

    1. 概述 本章介绍 值类型的装箱拆箱.类型转换 以及 C#4.0新推出的 dynamic 关键字. 2. 主要内容 2.1 装箱和拆箱 2.2 类型转换 有四种方式可以实现类型转换: ① 隐式转换: ...

  6. struts2 s:if标签以及 #,%{},%{#}的使用方法等在资料整理

    <s:if>判断字符串的问题: 1.判断单个字符:<s:if test="#session.user.username=='c'"> 这样是从session ...

  7. moses:processPhraseTable被删除

    今年一月,processPhraseTable被删除了,具体原因如下: https://www.mail-archive.com/moses-support@mit.edu/msg11372.html ...

  8. DB2缓冲池、表空间

    在DB2中建立表空间得指向该表空间所属缓冲池,否则表空间指向默认缓冲池 1.缓冲池 1.1 创建缓冲池 语法:CREATE BUFFERPOOL <bp_name> SIZE <nu ...

  9. VMware共享目录设置

    1.保证虚拟机中已经成功安装了 VMware Tools (非常关键) 2.打开VMware,并使虚拟机处于关机状态,然后请按图中箭头所示进行操作 这样就大功告成了,此时进入虚拟机, 执行命令 cd  ...

  10. [原创]Postgres-XC集群笔记-概念与环境搭建

    文所描述的Postgres-XC版本:v1.2.1项目主页地址:http://sourceforge.net/projects/postgres-xc/ pdf文件下载: Postgres-XC集群搭 ...