一场很很多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. ok6410的DMA裸机总结

    1.为何使用DMA:为了提高CPU的工作效率,避免多余的等待时间 2.关于DMA控制器:(1)通道数:2440有4个通道,6410有4个DMA控制器(初始化的时候要选择),32个通道.210有两种DM ...

  2. python 循环、循环设计、循环对象

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 1.循环 循环用于重复执行一些程序块.从上一讲的选择结构,我们已经看到了如何用缩进 ...

  3. LightOJ 1317 第八次比赛 A 题

    Description You probably have played the game "Throwing Balls into the Basket". It is a si ...

  4. MySql 用户 及权限操作

    bin/msyql -h host -u user -p    bin/mysql -u mysql -p  本地登录 如无密码按回车直接进入mySql   bin/mysqladmin -u roo ...

  5. Android--将图片存放到我们本地

    代码里面有详细的解释,我就不多说了 //处理并保存图像 private File dealPhoto(Bitmap photo){ FileOutputStream fileOutputStream ...

  6. 使用Handler和Timer+Timertask实现简单的图片轮播

    布局文件就只放了一个简单的ImageView,就不展示了. 下面是Activity package com.example.administrator.handlerthreadmessagedemo ...

  7. jdk 1.5

    1995.5.23 java语言诞生 sun公司推出java语言的同时,也推出了一系列的开发工具,比如JDK(java development Kit)JVMjava API 时间 版本 API 用途 ...

  8. 微软云平台媒体服务实践系列 1- 使用静态封装为iOS, Android 设备实现点播(VoD)方案

    微软的云平台媒体服务为流媒体服务提供了多种选择,在使用流媒体服务为企业做流媒体方案时,首先需要确认要流媒体接收目标,如针对广大iOS, Android移动设备,由于它们都支持HLS 格式的流媒体,基于 ...

  9. 记录:asp.net mvc 中 使用 jquery 实现html5 实现placeholder 密码框 提示兼容password IE6

    @{ViewBag.Title = "完美结合";} <script>var G_start_time = new Date;</script> <! ...

  10. 十一、从头到尾彻底解析Hash 表算法

    在研究MonetDB时深入的学习了hash算法,看了作者的文章很有感触,所以转发,希望能够使更多人受益! 十一.从头到尾彻底解析Hash 表算法 作者:July.wuliming.pkuoliver  ...