一场很很多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. ASP.NET MVC5学习笔记之Filter基本介绍

    Filter是ASP.NET MVC框架提供的基于AOP(面向方面)设计,提供在Action执行前后做一些非业务逻辑通用处理,如用户验证,缓存等.现在来看看Filter相关的一些类型信息. 一.基本类 ...

  2. 新成员!Visual Studio Code --跨平台的开发工具(支持OSX, Linux 和 Windows)

    原文出处:新成员!Visual Studio Code --跨平台的开发工具(支持OSX, Linux 和 Windows) 这是我的文章备份  http://www.dotblogs.com.tw/ ...

  3. 第十一章 管理类型(In .net4.5) 之 管理对象的生命周期

    1. 概述 本章内容包括 管理非托管资源.使用IDisposable接口 以及 管理析构器和垃圾回收. 2. 主要内容 2.1 理解垃圾回收机制 ① 代码执行的时候,内存中有两个地方存放数据项:堆 和 ...

  4. TreeSet,Comparator

    ThreeSet能够对集合中的对象排序,当TreeSet想集合中加入一个对象时,会把它插入到有序的对象序列中. ThreeSet自带了一个排序方法,这个方法规定了一般数据的排序规则,如果用户想要规定自 ...

  5. EMVTag系列16《AC响应数据》

    在一个联机交易中,要传送到发卡行的专有应用数据. 字段 长度(字节) 赋值 说明 长度 1 07 分散密钥索引 1 00 密文版本号 1 01 根据发卡行密钥版本设置 卡片验证结果(CVR) 4 03 ...

  6. 观察者模式学习--使用jdk的工具类简单实现

    观察者模式学习之二:使用jdk的自带的工具类实现,与自己实现相比,两者有以下的区别: 1,自己实现,需要定义观察者的接口类和目标对象的接口类.使用java util的工具类,则不需要自己定义观察者和目 ...

  7. 使用golang+java实现基于ecb的3eds加解密

    http://www.100hack.com/2014/04/14/golang%E4%B8%AD%E7%9A%84des%E5%8A%A0%E5%AF%86ecb%E6%A8%A1%E5%BC%8F ...

  8. iOS开发的22个奇谲巧技

    结合自身的实践开发经验总结出了22个iOS开发的小技巧,以非常欢乐的语调轻松解决开发过程中所遇到的各种苦逼难题,光读着便已忍俊不禁. 1. TableView不显示没内容的Cell怎么办? 类似于图1 ...

  9. swift 基于SDK8.0 获取当前时间

    var date = NSDate.date() var timeFormatter = NSDateFormatter() timeFormatter.dateFormat = "MM-d ...

  10. [开源应用]利用HTTPHandler+resumableJs+HTML5实现拖拽上传[大]文件

    前言: 大文件传输一直是技术上的一大难点.文件过大时,一些性提交所有的内容进内存是不现实的.大文件带来问题还有是否支持断点传输和多文件同时传输. 本文以resumableJs为例,介绍了如何在ASP. ...