RCC 2014 Warmup (Div. 2)
一场很很多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)的更多相关文章
- RCC 2014 Warmup (Div. 2) ABC
题目链接 A. Elimination time limit per test:1 secondmemory limit per test:256 megabytesinput:standard in ...
- RCC 2014 Warmup (Div. 2) A~C
近期CF的pretext真是一场比一场弱.第一次在CF上被卡cin.cout.... A. Elimination time limit per test 1 second memory limit ...
- RCC 2014 Warmup (Div. 1)
A 暴力 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm& ...
- RCC 2014 Warmup (Div. 2) 蛋疼解题总结
A. Elimination time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- CodeForces - 417E(随机数)
Square Table Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit ...
- CodeForces - 417B (思维题)
Crash Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Status ...
- CodeForces - 417A(思维题)
Elimination Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit ...
- Codeforces 417 C
Football Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Sta ...
- CodeForces比赛总结表
Codeforces A B C D ...
随机推荐
- Thinkpad 小紅點設定
因为我只需要这么多设置,所以就只写这么多了sudo gedit /etc/rc.local echo -n 240 > /sys/devices/platform/i8042/serio1/se ...
- DELPHI 单元文件结构
unit Unit1; interface {接口部分开始} uses {引用单元列表,这是可选的,如果包含必须紧跟interface关键字} {接口部分声明常量/类型/变量/过程和函数,这些声明对引 ...
- DataTable使用总结
1.DataTable数据去重 static void Main(string[] args) { DataTable dt = new DataTable();//创建表 DataColumn dc ...
- Mongodb初学习--安装、试用
MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可扩展的高性能数据存储解决方案. 在MongoDB中数据被分组存储在数据集中,被称为一个集合(Collection ...
- python2.7抓取豆瓣电影top250
利用python2.7抓取豆瓣电影top250 1.任务说明 抓取top100电影名称 依次打印输出 2.网页解析 要进行网络爬虫,利用工具(如浏览器)查看网页HTML文件的相关内容是很有必要,我使用 ...
- SQL30081N 检测到通信错误。正在使用的通信协议:"TCP/IP"
环境描述: 今天在虚拟机上安装了Linux系统,并且装了DB2,但是在连接的时候遇到了个问题,百思不得其解.下面是具体问题跟解决办法 问题描述: 解决办法: 1.先ping服务器是否可以ping通. ...
- Oracle表结构转换SqlSERVER表结构 脚本
在审计工作中,有时需要将Oracle的表结构修改后再SqlSERVER中创建表结构,然后将数据导入到SqlSERVER中,在修改表结构的过程中方法狠多.手工修改,最蠢的方法,或者用工具UE批量修改,还 ...
- Union-SQL Server学习笔记
1.简单笔记 数据库查询语句中,通过UNION组合查询语句,可以将两个或更多查询的结果组合为单个结果集,该结果集包含组合查询中的所有查询的全部行. 利用UNION语句可以实现将不同数据表中符合条件,不 ...
- SystemServer相关
SystemServer分析 由Zygote通过Zygote.forkSystemServer函数fork出来的.此函数是一个JNI函数,实现在dalvik_system_Zygote.c中. 1.S ...
- OpenStack的bridge_sto off的解释
北京_张华(28620211) 2014/1/27 星期一 11:10:57传统的网络是通过STP协议来避免交换机在二层形成环路,但是对于虚拟交换机,因为有东西向的流量,故将bridge_stp设成o ...