二分 题目 压缩打包 Special Judge? 不不不 当然不是
http://noi.openjudge.cn/ch0111/
No | 题目 | 分数 | |
01 | 查找最接近的元素 | 10 | 3176 |
02 | 二分法求函数的零点 | 10 | 2181 |
03 | 矩形分割 | 10 | 1420 |
04 | 网线主管 | 10 | 1648 |
05 | 派 | 10 | 1581 |
06 | 月度开销 | 10 | 1449 |
07 | 和为给定数 | 10 | 1906 |
08 | 不重复地输出数 | 10 | 1790 |
09 | 膨胀的木棍 | 10 | 768 |
10 | 河中跳房子 | 10 | 2027 |
------------------------------萌萌的分割线------------------------------
T1
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define INF 0x3f3f3f3f
using namespace std; int a[],ans,flag,M,N; int erfen(int x){
int l=,r=N;
while(r-l>){
int mid=l+(r-l)/;
if(a[mid]>=x){
r=mid;
}
else{
l=mid;
}
}
int pos=,cha=INF;
for(int i=l-<?:l-;i<=r+;i++){
if(abs(a[i]-x)<cha){
pos=i;
cha=abs(a[i]-x);
}
}
return a[pos];
} int main(){
// freopen("01.in","r",stdin); memset(a,0x3f,sizeof(a));
scanf("%d",&N);
for(int i=;i<=N;i++){scanf("%d",&a[i]);}
scanf("%d",&M);
while(M--){
int x;scanf("%d",&x);
printf("%d\n",erfen(x));
}
fclose(stdin);fclose(stdout);return ;
}要恶心地多判断几次
T2
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define INF 0x3f3f3f3f
#define eps 1e-9
using namespace std; int a[],N; double cal(double x){
return x*x*x*x*x-15.0*x*x*x*x+85.0*x*x*x-225.0*x*x+274.0*x-121.0;
} double erfen(double l,double r){
while(r-l>eps){
double mid=(l+r)/2.0;
if(cal(mid)>=){
l=mid;
}
else {
r=mid;
}
}
return l;
} int main(){
// freopen("01.in","r",stdin); printf("%.6f",erfen(1.5,2.4)); fclose(stdin);fclose(stdout);return ;
}l和r别弄反了
T3
T4
T5
T6
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define INF 0x3f3f3f3f
using namespace std; int a[],M,N,kkk,mx; int solve(){
int ans=,flag=;
for(int i=;i<=N+;i++){
int x=a[i];
if(flag+x>M) flag=x,++ans;
else flag+=x;
}
return ans;
} void erfen(){
int cnt=;
int ans=INF;
int l=mx,r=INF;
while(cnt++< && l!=r){
M=(l+r)/;
int k=solve();
if(k>kkk){
l=M;
}
else{
r=M;
}
if(k<=kkk) ans=min(ans,M);
// cout<<k<<" "<<l<<" "<<r<<endl;
}
cout<<ans;
} int main(){
// freopen("01.in","r",stdin); memset(a,0x3f,sizeof(a));
scanf("%d%d",&N,&kkk);
for(int i=;i<=N;i++){scanf("%d",&a[i]);mx=max(mx,a[i]);} erfen(); fclose(stdin);fclose(stdout);return ;
}这件事告诉我们,一定要写随机数据
随机数据查错非常给力
T7
T8
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define INF 0x3f3f3f3f
using namespace std; int a[],N; int main(){
// freopen("01.in","r",stdin); scanf("%d",&N);
for(int i=;i<=N;i++) scanf("%d",&a[i]);
sort(a+,a+N+);
for(int i=;i<=N;i++){
if(a[i]!=a[i+]) printf("%d ",a[i]);
} fclose(stdin);fclose(stdout);return ;
}我选择偷懒,吐舌~
T9
T10
噜噜噜~
二分 题目 压缩打包 Special Judge? 不不不 当然不是的更多相关文章
- csu oj 1344: Special Judge
Description Given a positive integer n, find two non-negative integers a, b such that a2 + b2 = n. I ...
- 如何给LOJ补全special judge
首先你要会写一个叫$data.yml$的东西, 这里面记录了这道题的$subtask$计分策略 也告诉了评测姬这道题是提交答案还是$spj$还是交互题 那么,$YAML$语言是啥啊? 别问我,我也不会 ...
- Special Judge Ⅱ
Problem Description Q:什么是 Special Judge,Special Judge 的题目有什么不同? A:一个题目可以接受多种正确答案,即有多组解的时候,题目就必须被 Spe ...
- 【教程】如何正确的写一个Lemon/Cena的SPJ(special judge)
转自:http://www.cnblogs.com/chouti/p/5752819.html Special Judge:当正确的输出结果不唯一的时候需要的自定义校验器 首先有个框架 #includ ...
- 服务端生成word并压缩打包下载
所需工具 phpwrod 库 php_zip 扩展 下载phpword库,放到类加载路径. 安装php_zip扩展 下载地址 http://pecl.php.net/package/zip linux ...
- Linux中的文件压缩,打包和备份命令
压缩解压命令 gzip 文件 -c : 将压缩数据输出到屏幕,可用来重定向 -v 显示压缩比等信息 -d 解压参数 -t 用来检验一个压缩文件的一致性看看档案有没错 -数字 : 压 ...
- C# 压缩打包文件下载
C# 压缩打包文件下载 public class MyNameTransfom : ICSharpCode.SharpZipLib.Core.INameTransform { #region INam ...
- [拾 得] zip gzip bzip2 & tar 压缩/打包 四大金刚
坚持知识分享,该文章由Alopex编著, 转载请注明源地址: http://www.cnblogs.com/alopex/ 索引: 介绍压缩和打包 gzip bzip2 zip 的基本使用 gz ...
- mvn项目压缩打包
通常情况下,maven打包结果为jar或war包.如果需要一并打包配置文件等参数,通过resources配置指定需要打包的文件参数,如下示例: <project> ... <!-- ...
随机推荐
- 常用js函数封装
see them... // 获取网址的get参数 var GET = function(name) { var reg = new RegExp("(^|&)" + na ...
- 前后端分离中,Gulp实现头尾等公共页面的复用
前言 通常我们所做的一些页面,我们可以从设计图里面看出有一些地方是相同的.例如:头部,底部,侧边栏等等.如果前后端分离时,制作静态页面的同学,对于这些重复的部分只能够通过复制粘贴到新的页面来,如果页面 ...
- cacti 安装
cacti:是常用的一个监控软件(开源,免费) 特点:重图形,有数据历史,需要用到数据库的支持,支持web配置,默认不支持告警,可以加插件 cacti安装 1.安装扩展源epel (nagios 和z ...
- 你不知道的Spring配置文件
Spring配置文件是用于指导Spring工厂进行Bean生产.依赖关系注入(装配)及Bean实例分发的"图纸".Java EE程序员必须学会并灵活应用这份"图纸&quo ...
- 关于for循环------swift3.0
在程序开发当中,for循环使用的频率无疑是最高的.常用的swift循环是递增式遍历.当然各种循环,swift都能办到.但其大多采用关键字形式实现,大部分开发者更喜欢直接使用C式循环代码.在swift3 ...
- 51nod1102(数塔)
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1002 题意:中文题诶- 思路:简单dp 从底层往上递推,每个 ...
- python之线程进程协成
线程与进程 什么是线程 线程是进程一个实体,是CPU调度和分派的基本单位,它是比进程更小的能独立运行的基本单位,线程自己基本上不拥有系统资源,只拥有一点在运行中必不可少的资源,但是它可与同属一个线程的 ...
- python学习笔记(5)--迭代器,生成器,装饰器,常用模块,序列化
生成器 在Python中,一边循环一边计算的机制,称为生成器:generator. 如: >>> g = (x * x for xin range(10)) >>> ...
- 【Java EE 学习 82 下】【MAVEN整合Eclipse】【MAVEN的一些高级概念】
一.MAVEN整合Eclipse MAVEN是非常优秀,但是总是要开命令行敲命令是比较不爽的,我们已经习惯了使用IDE,所以还有一种将MAVEN整合到Eclipse的方法. 详情查看:http://w ...
- Win10 UI入门 RenderTransform属性分析之Translate 平移变形
对齐方式是中心底部对齐: HorizontalAlignment="Center" VerticalAlignment="Bottom" 以底部边为起始线,向上 ...