二分 题目 压缩打包 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> ... <!-- ...
随机推荐
- 负载均衡-基础-一致性哈希算法及java实现
一致性hash算法,参考: http://www.blogjava.net/hello-yun/archive/2012/10/10/389289.html 针对这篇文章,加入了自己的理解,在原有的代 ...
- js 对数据转换成数据容量单位
function bytesToSize(value) { alert(value); alert('value'); debugger; if (value === 0) return '0 B'; ...
- Linux下查看磁盘与目录的容量——df、du
df:列出文件系统的整体磁盘使用量: du:评估文件系统的磁盘使用量(常用于评估目录所占容量) df参数: -a:列出所有的文件系统,包括系统特有的/proc等文件系统 -k:以KB的容量显示各文件系 ...
- python scipy学习-曲线拟合
根据某地每月的平均温度[17, 19, 21, 28, 33, 38, 37, 37, 31, 23, 19, 18]拟合温度函数. import numpy as np import matplot ...
- apple常用网址
https://developer.apple.com/ https://itunesconnect.apple.com/ iTunes Connect Developer Guide https:/ ...
- [正则表达式]PCRE环视功能
设想一下这个问题,假设为了方便长串数字的阅读性,需要为其添加逗号作为分隔,需要怎么做呢? 2569836495 => 2,569,836,495 正则表达式的匹配通常是从左往右的,这导致无法使用 ...
- Python模块之configpraser
Python模块之configpraser 一. configpraser简介 用于处理特定格式的文件,其本质还是利用open来操作文件. 配置文件的格式: 使用"[]"内包含 ...
- CocoaPods报错:The dependency `AFNetworking ` is not used in any concrete target 解决办法
产生这个问题的原因是最新版本的CocoaPods把Podfile文件的书写格式改变了,官网推荐用如下格式书写: platform :ios, '8.0' use_frameworks! target ...
- Touch ID 实现
Touch ID 1.要求 机型:iPhone 5s以上 系统:iOS8以上 框架:#import <LocalAuthentication/LocalAuthentication.h> ...
- java方法强制传递引用参数(做为返回值),改变被传递参数值。
Java传递参数分为2种: 值类型,Java里面也叫简单类型,这种参数类型的传递的是它的副本拷贝: 引用类型,传递的是对象引用地址,如果在方法内改变该参数对象属性即是对原引用对象的改变:如果不想这样传 ...