题目质量差评!为什么不给数据范围!

A.乘积最大3

题目:http://dev.luogu.org/problem/show?pid=2172

题解:sb题,均值定理。

代码:

 #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define inf 1000000000
#define maxn 10000000
#define maxm 500+100
#define eps 1e-10
#define ll long long
#define pa pair<int,int>
#define for0(i,n) for(int i=0;i<=(n);i++)
#define for1(i,n) for(int i=1;i<=(n);i++)
#define for2(i,x,y) for(int i=(x);i<=(y);i++)
#define for3(i,x,y) for(int i=(x);i>=(y);i--)
#define mod 1000000007
using namespace std;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=*x+ch-'';ch=getchar();}
return x*f;
}
ll n,m,tmp,a[maxn];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
n=read();m=read();
for1(i,m)a[i]=n/m;
tmp=n-(n/m)*m;
for3(i,m,m-tmp+)a[i]++;
for1(i,m-)printf("%lld ",a[i]);
printf("%lld\n",a[m]);
return ;
}

B.刮油漆

题目:http://dev.luogu.org/problem/show?pid=U155

题解:先差分算出每个点的高度,然后单调栈搞掉。

不知道哪写残了一直WA,没AK真不爽。。。

代码:

 #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define inf 1000000000
#define maxn 1000000+1000
#define maxm 500+100
#define eps 1e-10
#define ll long long
#define pa pair<int,int>
#define for0(i,n) for(int i=0;i<=(n);i++)
#define for1(i,n) for(int i=1;i<=(n);i++)
#define for2(i,x,y) for(int i=(x);i<=(y);i++)
#define for3(i,x,y) for(int i=(x);i>=(y);i--)
#define mod 1000000007
using namespace std;
inline int read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=*x+ch-'';ch=getchar();}
return x*f;
}
int n,ans,mx,top,a[maxn],b[maxn],sta[maxn];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
n=read();
for1(i,n)
{
int x=read(),y=read();
a[x]++,a[y+]--;
if(y+>mx)mx=y+;
}
for1(i,mx)b[i]=b[i-]+a[i];
ans=mx;
sta[top=]=;
for1(i,mx)
{
while(top>&&sta[top]>b[i])top--;
if(sta[top]==b[i])ans--;else sta[++top]=b[i];
}
printf("%d\n",ans);
return ;
}

C.选学霸

题目:http://dev.luogu.org/problem/show?pid=2170

题解:并查集完了之后背包,怎么昨天一天做了两道这种题?

代码:

 #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define inf 1000000000
#define maxn 1000000+1000
#define maxm 500+100
#define eps 1e-10
#define ll long long
#define pa pair<int,int>
#define for0(i,n) for(int i=0;i<=(n);i++)
#define for1(i,n) for(int i=1;i<=(n);i++)
#define for2(i,x,y) for(int i=(x);i<=(y);i++)
#define for3(i,x,y) for(int i=(x);i>=(y);i--)
#define mod 1000000007
using namespace std;
inline int read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=*x+ch-'';ch=getchar();}
return x*f;
}
int n,m,k,ans,tot,sum,fa[maxn],a[maxn],s[maxn];
bool f[maxn];
inline int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
n=read();k=read();m=read();
for1(i,n)fa[i]=i;
for1(i,m)
{
int x=find(read()),y=find(read());
if(x!=y)fa[x]=y;
}
for1(i,n)s[find(i)]++;
for1(i,n)if(s[i])a[++tot]=s[i];
f[]=;
for1(i,tot)
{
for3(j,sum,)
if(f[j])f[j+a[i]]=;
sum+=a[i];
}
for3(i,k,)if(f[i]){ans=i;break;}
for2(i,k,n)if(f[i]){if(abs(i-k)<k-ans)ans=i;break;}
printf("%d\n",ans);
return ;
}

这场比赛没有好好做,因为看起来都是些sb题。。。

CONTEST45 呵呵呵呵呵的更多相关文章

  1. COJN 0486 800401反质数 呵呵呵呵呵

    800401反质数 难度级别:A: 运行时间限制:1000ms: 运行空间限制:51200KB: 代码长度限制:2000000B 试题描述 将正整数 x 的约数个数表示为 g(x).例如,g(1)=1 ...

  2. CSDN的博客搜索功能不又给力了呵呵呵呵

    不得不说,CSDN博客的搜索功能是在太弱了.而且一直都很弱,以至于我每次想在自己博客上找自己发的文章都变得那么难.做一个搜索博客内文章的功能没有那么难吧? 还是说CSDN已经放弃了博客这一块了? 我发 ...

  3. 呵呵呵呵。。。系统还原了,终于可以用IE登陆百度了

    原文发布时间为:2009-12-19 -- 来源于本人的百度文章 [由搬家工具导入] 呵呵呵呵。。。今天终于有时间把系统还原了,终于可以用IE登陆百度了

  4. sycCMS PHP V1.0---呵呵呵呵呵

    闲的无聊,随便找了份代码看了看. //search.php 第17行 第49行 ...... $keyword=SafeRequest("keyword","post&q ...

  5. 用.NET MVC实现长轮询,与jQuery.AJAX即时双向通信

    两周前用长轮询做了一个Chat,并移植到了Azure,还写了篇博客http://www.cnblogs.com/indream/p/3187540.html,让大家帮忙测试. 首先感谢300位注册用户 ...

  6. java笔记——Java关键字static、final使用小结

    static  1. static变量     按照是否静态的对类成员变量进行分类可分两种:一种是被static修饰的变量,叫静态变量或类变量:另一种是没有被static修饰的变量,叫实例变量.两者的 ...

  7. p2p tcp nat 原理图+源码(原创)

    现今网上p2p的 udp nat穿透 文章 多如牛毛, p2p tcp nat的文章寥寥无几 ,up主研究了几天 终于有所收获,特来向大家分享,请大家多多支持! 1.首先你要有台外网服务器 或者 电信 ...

  8. 【转】如何使用VS 2013发布一个可以在Windows XP中独立运行的可执行文件

    问题描述: 用VS2013写好一个程序,在本机上运行一切正常.但是如果直接把exe文件放到另一台机器上用,则会出现: Windows XP:不是一个正常的win32程序 Window 7:缺少msvc ...

  9. 一般企业网站,电商可以完全可以水平拓展的lanmp系统架构

    本来不打算把所有的架构方案和基础技术写出,毕竟是吃饭的家伙事,拿这套东西去面试完全可以对付只做过中小网站的经验的开发面试人员,但是我也是从别人的博客和文章学习和实践出来的 如果你没有基础的linux一 ...

随机推荐

  1. HDU 5505 - BestCoder Round #60 - GT and numbers

    题目链接 : http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=641&pid=1002 思路 : N有若 ...

  2. Linux下安装GCC5.3.0(亲测有效)

    对于linux小白来说,只需要先知道怎么安装,至于为什么等学了linux再说吧..知识不系统的坏处啊! 首先,一般ubuntu上都预装了低级版本的Gcc,完全可以应付刷OJ时的C+Class+STL的 ...

  3. UVa 116: Undirectional TSP

    简单动态规划题.用取模实现第一行与最后一行连续,注意取字典序即可. 我的解题代码如下: #include <iostream> #include <cstdio> #inclu ...

  4. Demon_Tank (坦克移动发射子弹)

    using UnityEngine; using System.Collections; public class Tank : MonoBehaviour { //子弹预设体 public Game ...

  5. JAVA 将接口的引用指向实现类的对象

    有一个很简单的例子,java.util中的类ArrayList实现了接口List则生成ArrayList对象时可用以下语句. List list=new ArrayList(); 也就是说所有实现了接 ...

  6. android中发送邮件

    在移动互联网时代,手机邮件已不是什么新鲜事了,我们可以使用内置的Gmail引擎来发送邮件,也可以使用SMTP来发送邮件,下面用一个简单示例来演示邮件的发送,包括单方发送邮件.多方发送邮件以及抄送邮件, ...

  7. 第四章 Activity和Activity调用栈分析 系统信息与安全机制 性能优化

    1.Activity生命周期理解生命周期就是两张图:第一张图是回字型的生命周期图第二张图是金字塔型的生命周期图 注意点(1)从stopped状态重新回到前台状态的时候会先调用onRestart方法,然 ...

  8. XShell连接 Linux系统,显示中文乱码

    摘要: Linux系统,中文显示乱码 XShell是一个强大的安全终端模拟软件,它支持SSH1, SSH2及 Microsoft Windows平台的Telnet NetSarang Xshell 4 ...

  9. Linux 创建swap分区

    --首先分出一个分区 /dev/sda5 (注意分区类型)mkswap /dev/sda5           --格式化分区成swap格式swapon /dev/sda5           --激 ...

  10. .net I/O操作 导图

    稍微总结下,System.IO提供了四种类型来实现,对单个文件和计算机目录结构的操作.Directory和File通过静态成员实现建立.删除.复制和移动操作(上图没有提及).而FileInfo和Dir ...