二分 题目 压缩打包 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> ... <!-- ...
随机推荐
- 使用Navicat Preminum时,发现的几个好用的功能
- 【项目】百度搜索广告CTR预估
-------倒叙查看本文. 6,用auc对测试的结果进行评估: auc代码如下: #!/usr/bin/env python import sys def auc(labels,predicted_ ...
- Unity 好坑的Save Scene
在编辑一个Untiy工程的时候,有很多的教程提到了 "Save Scene",也知道是干么用的.但是,后面打开工程的时候,工程界面是很多东西都不见了,又忘了有个Save Scene ...
- 《转载》跟我学SpringMVC
在线版目录 第一章 Web MVC简介 第二章 Spring MVC入门 第三章 DispatcherServlet详解 第四章 Controller接口控制器详解(1) 第四章 Controller ...
- Django (2)
一.Django基本 程序编写 a. url.py /index/ -> func b. views.py def func(request): # 包含所有 ...
- SQL表值函数(上月添加1-28)
ALTER function [dbo].[fn_getdate3] ( ) ) RETURNS @Table_Var TABLE ( LastTime datetime ) as begin Dec ...
- vue笔记
安装vue脚手架工具 sudo cnpm install -g vue-cli
- web.config数据库连接字符串
我们在做VB数据库经典实例这本书上的五个小例子和做学生信息管理系统时,都需要通过Vb链接数据库,在众多的链接方式中connectionstring字符串应该是较为简单的一种方式,下面我来详细介绍它的一 ...
- 9. 了解 Cocoa-百度百科
Cocoa是苹果公司为Mac OS X所创建的原生面向对象的API,是Mac OS X上五大API之一(其它四个是Carbon.POSIX.X11和Java). 苹果的面向对象开发框架,用来生成 Ma ...
- oracleDBA-D3
1.静态参数文件 PFILE:使用操作系统提供的VIM进行编辑,包含多个参数文件 参数文件名是:init.ora(如: D:\app\Administrator\admin\orcl\pfile) 其 ...