【EOJ Monthly 2018.2 (Good bye 2017)】
23333333333333333
由于情人节要回家,所以就先只放代码了。
此题是与我胖虎过不去。
【E. 出老千的 xjj】
- #include<cstdio>
- #include<cstdlib>
- #include<cstring>
- #include<iostream>
- #include<algorithm>
- using namespace std;
- const int maxn=;
- #define ll long long
- int i,j,n,k,x;
- ll p[maxn+],sum[maxn+],tmp,ans=,Max=;
- int main()
- {
- scanf("%d%d",&n,&k);
- for(i=;i<=n;i++){
- scanf("%d",&x);
- tmp+=x;
- p[x]++;
- }
- if(tmp<=k){
- printf("0\n");
- return ;
- }
- for(i=;i<=maxn;i++) {
- sum[i]=sum[i-]+p[i]*i;
- p[i]+=p[i-];
- }
- for(i=;i<=maxn;i++){
- ll yy=(k-)/i+;
- ll xx=n;
- tmp=;
- //if(k%i==0&&yy<xx) continue;
- if(k%i==) continue; //上面的WA了
- for(j=;j<maxn/i;j++){
- int n1=(j+)*i,n2=j*i+;
- if(n2<) n2=;
- xx+=(p[n1]-p[n2-]);
- tmp+=(p[n1]-p[n2-])*((j+)*i)-sum[n1]+sum[n2-];
- if(k%i==&&yy<xx) break;
- if(tmp>ans) break;
- }
- if((k%i==&&xx<=yy)||k%i!=){
- ans=min(ans,tmp);
- }
- }
- cout<<ans<<endl;;
- return ;
- }
【A2】
- #include<iostream>
- #include<cstdio>
- #include<cstring>
- #include<ctime>
- #include<cstdlib>
- #include<algorithm>
- #include<cmath>
- #include<string>
- using namespace std;
- int n,k,p;
- int num[]={,,,,,},cost[];
- long long f[];
- int main(){
- scanf("%d%d%d",&n,&k,&p);
- for(int i=;i<=k;i++){
- long long temp=1LL*i*p;
- for(int j=;j<=;j++)
- if(temp>=num[j]){
- cost[i]+=temp/num[j];
- temp%=num[j];
- }
- }
- memset(f,,sizeof(f));
- f[]=;
- for(int i=;i<=;i++)
- for(int j=max(,i-k);j<i;j++)
- f[i]=min(f[i],f[j]+cost[i-j]);
- if(n<=){
- cout<<f[n]<<endl;
- return ;
- }
- int way=;
- for(int i=;i<=k;i++)
- if(1.0*i/cost[i]>1.0*way/cost[way])
- way=i;
- int t1=n/way,t2=n%way;
- long long ans=1LL*t1*cost[way]+f[t2];
- for(int i=;i<=;i++){
- t1=n/way-i;
- t2=n-way*t1;
- ans=min(ans,1LL*t1*cost[way]+f[t2]);
- }
- cout<<ans<<endl;
- return ;
- }
【B】
- #include<iostream>
- #include<cstdio>
- #include<cstring>
- #include<ctime>
- #include<cstdlib>
- #include<algorithm>
- #include<cmath>
- #include<string>
- using namespace std;
- int N,sta[];
- int f[];
- struct edge{
- int x,y;
- }e[];
- int have[][],cnt[];
- int check(int x,int s){
- bool flag=;
- for(int i=;i<=cnt[x];i++)
- if(s&sta[have[x][i]]){
- flag=;
- break;
- }
- if(!flag)
- return -;
- for(int i=;i<=cnt[x];i++)
- if(s&sta[have[x][i]])
- s^=sta[have[x][i]];
- return s;
- }
- int dfs(int s){
- if(f[s]!=-)
- return f[s];
- for(int i=;i<=N;i++){
- int temp=check(i,s);
- if(temp!=-)
- if(!dfs(temp))
- return f[s]=;
- }
- return f[s]=;
- }
- int main(){
- sta[]=;
- for(int i=;i<=;i++)
- sta[i]=sta[i-]*;
- scanf("%d",&N);
- for(int i=;i<N-;i++){
- scanf("%d%d",&e[i].x,&e[i].y);
- have[e[i].x][++cnt[e[i].x]]=i;
- have[e[i].y][++cnt[e[i].y]]=i;
- }
- memset(f,-,sizeof(f));
- f[]=;
- if(dfs(sta[N-]-))
- printf("First\n");
- else
- printf("Second\n");
- return ;
- }
【F】
- #include<cstdio>
- #include<cstdlib>
- #include<iostream>
- using namespace std;
- const int maxn=;
- int main()
- {
- int T;
- double a,b,c,x,y,z;
- while(~scanf("%lf%lf%lf",&x,&y,&z)){
- a=(2.0*y-z+x)/2.0;
- b=x-a;
- c=(z-a-b)/2.0;
- if(a<=||b<=||c<=) printf("Wrong\n");
- else printf("%.6lf\n",a);
- } return ;
- }
【EOJ Monthly 2018.2 (Good bye 2017)】的更多相关文章
- 【EOJ Monthly 2018.7】【D数蝌蚪】
https://acm.ecnu.edu.cn/contest/92/problem/D/ D. 数蝌蚪 Time limit per test: 2.0 seconds Memory limit: ...
- EOJ Monthly 2018.8 D. Delivery Service-树上差分(边权/边覆盖)(边权转点权)(模板题)
D. Delivery Service 单测试点时限: 2.5 秒 内存限制: 512 MB EOJ Delivery Service Company handles a massive amount ...
- EOJ Monthly 2018.7
准备继续大学acm啦 又要开始愉快的码码码啦 第一次在华东师大OJ上面做题 看来EOJ上的积分体质是假的,我怎么一把上红??? A.数三角形 神tm的防AK题放在A,出题人很不友好啊... 先写了个暴 ...
- EOJ Monthly 2018.4
A. ultmaster 的小迷妹们 Time limit per test: 2.0 seconds Memory limit: 256 megabytes ultmaster 男神和他的小迷妹们准 ...
- EOJ Monthly 2018.4 (E.小迷妹在哪儿(贪心&排序&背包)
ultmaster 男神和小迷妹们玩起了捉迷藏的游戏. 小迷妹们都希望自己被 ultmaster 男神发现,因此她们都把自己位置告诉了 ultmaster 男神,因此 ultmaster 男神知道了自 ...
- [EOJ Monthly 2018.10][C. 痛苦的 01 矩阵]
题目链接:C. 痛苦的 01 矩阵 题目大意:原题说的很清楚了,不需要简化_(:з」∠)_ 题解:设\(r_i\)为第\(i\)行中0的个数,\(c_j\)为第\(j\)列中0的个数,\(f_{i,j ...
- EOJ Monthly 2018.11 D. 猜价格
猜价格 分两种情况讨论: k≤n,先猜至多 k 次 1,由于回答 <1 肯定是假的,所以可以把剩余系下是哪次错试出来,然后用至多 n 次搞定. k>n,每个数都猜两次,如果两次结果不一样, ...
- EOJ Monthly 2018.7 B.锐角三角形(数学几何+思维)
描述 是否存在面积为S/2的整点锐角三角形?存在输出Yes并输出三个整点坐标,否则输出No. 注意如果存在输出的坐标必须在long long范围内. Input 第一行一个整数S(1<=S< ...
- EOJ Monthly 2018.11 猜价格 (模拟)
分三种情况: 1.k=1.此时每次都说反话,反着二分即可. 2.1<k <= n.那么在前n次问答中一定会出现一次错误,通过不断输出1找出那个错误发生的位置(若回答是>那这就是错误) ...
随机推荐
- eclipse工具栏sdk和avd图标
打开菜单Window -> Customize Perspective -> Command Groups Availability -> 勾选Android SDK and AVD ...
- Twitter网站架构分析介绍
http://www.kaiyuanba.cn/html/1/131/147/7539.htm作为140个字的缔造者,twitter太简单了,又太复杂了,简单是因为仅仅用140个字居然使有几次世界性事 ...
- mysql truncate table命令使用总结
truncate使用注意 由于上过truncate table a_table命令一次当,将教训记录下来,以示警戒! mysql truncate table a_table命令受影响结果说明 ...
- iOS 摇一摇的实现
- (void)viewDidLoad { [super viewDidLoad]; [[UIApplication sharedApplication] setApplicationSupports ...
- C# Select SelectMany 区别
string[] text = { "Today is 2018-06-06", "weather is sunny", "I am happy&qu ...
- mysql + php 中文乱码 全是? 解决方法
在my.ini文件中找到[client]和[mysqld]字段,在下面均加上default-character-set=utf8,保存并关闭,重启服务器 在window下重启失败,这是因为你安装了高版 ...
- ETL Automation完整安装方法_(元数据存放在mysql数据库)
安装前介质准备: DBI-1.636.tar.gz DBD-mysql-4.037.tar.gz ETL.tar mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz P ...
- MVC入门——详细页
添加Action ShowDetail using System; using System.Collections.Generic; using System.Linq; using System. ...
- 开源流媒体客户端EasyClient手机端控制摄像机EasyCamera云台PTZ控制实现
本文转自EasyDarwin开源团队成员kim的博客:http://blog.csdn.net/jinlong0603/article/details/51835308 EasyCamera是Easy ...
- JavaScript精粹
序:好书是需要不断品读的!再读语言精粹,顺便做点笔记. 1.NaN是一个数值,它表示一个不能产生正常结果的运算结果.NaN不等于任何值,包括它自己.检测是否为NaN: isNaN(number). ...