23333333333333333

由于情人节要回家,所以就先只放代码了。

此题是与我胖虎过不去。

【E. 出老千的 xjj】

  1. #include<cstdio>
  2. #include<cstdlib>
  3. #include<cstring>
  4. #include<iostream>
  5. #include<algorithm>
  6. using namespace std;
  7. const int maxn=;
  8. #define ll long long
  9. int i,j,n,k,x;
  10. ll p[maxn+],sum[maxn+],tmp,ans=,Max=;
  11. int main()
  12. {
  13. scanf("%d%d",&n,&k);
  14. for(i=;i<=n;i++){
  15. scanf("%d",&x);
  16. tmp+=x;
  17. p[x]++;
  18. }
  19. if(tmp<=k){
  20. printf("0\n");
  21. return ;
  22. }
  23. for(i=;i<=maxn;i++) {
  24. sum[i]=sum[i-]+p[i]*i;
  25. p[i]+=p[i-];
  26. }
  27. for(i=;i<=maxn;i++){
  28. ll yy=(k-)/i+;
  29. ll xx=n;
  30. tmp=;
  31. //if(k%i==0&&yy<xx) continue;
  32. if(k%i==) continue; //上面的WA了
  33. for(j=;j<maxn/i;j++){
  34. int n1=(j+)*i,n2=j*i+;
  35. if(n2<) n2=;
  36. xx+=(p[n1]-p[n2-]);
  37. tmp+=(p[n1]-p[n2-])*((j+)*i)-sum[n1]+sum[n2-];
  38. if(k%i==&&yy<xx) break;
  39. if(tmp>ans) break;
  40. }
  41. if((k%i==&&xx<=yy)||k%i!=){
  42. ans=min(ans,tmp);
  43. }
  44. }
  45. cout<<ans<<endl;;
  46. return ;
  47. }

【A2】

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<ctime>
  5. #include<cstdlib>
  6. #include<algorithm>
  7. #include<cmath>
  8. #include<string>
  9. using namespace std;
  10. int n,k,p;
  11. int num[]={,,,,,},cost[];
  12. long long f[];
  13. int main(){
  14. scanf("%d%d%d",&n,&k,&p);
  15. for(int i=;i<=k;i++){
  16. long long temp=1LL*i*p;
  17. for(int j=;j<=;j++)
  18. if(temp>=num[j]){
  19. cost[i]+=temp/num[j];
  20. temp%=num[j];
  21. }
  22. }
  23. memset(f,,sizeof(f));
  24. f[]=;
  25. for(int i=;i<=;i++)
  26. for(int j=max(,i-k);j<i;j++)
  27. f[i]=min(f[i],f[j]+cost[i-j]);
  28. if(n<=){
  29. cout<<f[n]<<endl;
  30. return ;
  31. }
  32. int way=;
  33. for(int i=;i<=k;i++)
  34. if(1.0*i/cost[i]>1.0*way/cost[way])
  35. way=i;
  36. int t1=n/way,t2=n%way;
  37. long long ans=1LL*t1*cost[way]+f[t2];
  38. for(int i=;i<=;i++){
  39. t1=n/way-i;
  40. t2=n-way*t1;
  41. ans=min(ans,1LL*t1*cost[way]+f[t2]);
  42. }
  43. cout<<ans<<endl;
  44. return ;
  45. }

【B】

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<ctime>
  5. #include<cstdlib>
  6. #include<algorithm>
  7. #include<cmath>
  8. #include<string>
  9. using namespace std;
  10. int N,sta[];
  11. int f[];
  12. struct edge{
  13. int x,y;
  14. }e[];
  15. int have[][],cnt[];
  16. int check(int x,int s){
  17. bool flag=;
  18. for(int i=;i<=cnt[x];i++)
  19. if(s&sta[have[x][i]]){
  20. flag=;
  21. break;
  22. }
  23. if(!flag)
  24. return -;
  25. for(int i=;i<=cnt[x];i++)
  26. if(s&sta[have[x][i]])
  27. s^=sta[have[x][i]];
  28. return s;
  29. }
  30. int dfs(int s){
  31. if(f[s]!=-)
  32. return f[s];
  33. for(int i=;i<=N;i++){
  34. int temp=check(i,s);
  35. if(temp!=-)
  36. if(!dfs(temp))
  37. return f[s]=;
  38. }
  39. return f[s]=;
  40. }
  41. int main(){
  42. sta[]=;
  43. for(int i=;i<=;i++)
  44. sta[i]=sta[i-]*;
  45. scanf("%d",&N);
  46. for(int i=;i<N-;i++){
  47. scanf("%d%d",&e[i].x,&e[i].y);
  48. have[e[i].x][++cnt[e[i].x]]=i;
  49. have[e[i].y][++cnt[e[i].y]]=i;
  50. }
  51. memset(f,-,sizeof(f));
  52. f[]=;
  53. if(dfs(sta[N-]-))
  54. printf("First\n");
  55. else
  56. printf("Second\n");
  57. return ;
  58. }

【F】

  1. #include<cstdio>
  2. #include<cstdlib>
  3. #include<iostream>
  4. using namespace std;
  5. const int maxn=;
  6. int main()
  7. {
  8. int T;
  9. double a,b,c,x,y,z;
  10. while(~scanf("%lf%lf%lf",&x,&y,&z)){
  11. a=(2.0*y-z+x)/2.0;
  12. b=x-a;
  13. c=(z-a-b)/2.0;
  14. if(a<=||b<=||c<=) printf("Wrong\n");
  15. else printf("%.6lf\n",a);
  16. } return ;
  17. }

【EOJ Monthly 2018.2 (Good bye 2017)】的更多相关文章

  1. 【EOJ Monthly 2018.7】【D数蝌蚪】

    https://acm.ecnu.edu.cn/contest/92/problem/D/ D. 数蝌蚪 Time limit per test: 2.0 seconds Memory limit:  ...

  2. EOJ Monthly 2018.8 D. Delivery Service-树上差分(边权/边覆盖)(边权转点权)(模板题)

    D. Delivery Service 单测试点时限: 2.5 秒 内存限制: 512 MB EOJ Delivery Service Company handles a massive amount ...

  3. EOJ Monthly 2018.7

    准备继续大学acm啦 又要开始愉快的码码码啦 第一次在华东师大OJ上面做题 看来EOJ上的积分体质是假的,我怎么一把上红??? A.数三角形 神tm的防AK题放在A,出题人很不友好啊... 先写了个暴 ...

  4. EOJ Monthly 2018.4

    A. ultmaster 的小迷妹们 Time limit per test: 2.0 seconds Memory limit: 256 megabytes ultmaster 男神和他的小迷妹们准 ...

  5. EOJ Monthly 2018.4 (E.小迷妹在哪儿(贪心&排序&背包)

    ultmaster 男神和小迷妹们玩起了捉迷藏的游戏. 小迷妹们都希望自己被 ultmaster 男神发现,因此她们都把自己位置告诉了 ultmaster 男神,因此 ultmaster 男神知道了自 ...

  6. [EOJ Monthly 2018.10][C. 痛苦的 01 矩阵]

    题目链接:C. 痛苦的 01 矩阵 题目大意:原题说的很清楚了,不需要简化_(:з」∠)_ 题解:设\(r_i\)为第\(i\)行中0的个数,\(c_j\)为第\(j\)列中0的个数,\(f_{i,j ...

  7. EOJ Monthly 2018.11 D. 猜价格

    猜价格 分两种情况讨论: k≤n,先猜至多 k 次 1,由于回答 <1 肯定是假的,所以可以把剩余系下是哪次错试出来,然后用至多 n 次搞定. k>n,每个数都猜两次,如果两次结果不一样, ...

  8. EOJ Monthly 2018.7 B.锐角三角形(数学几何+思维)

    描述 是否存在面积为S/2的整点锐角三角形?存在输出Yes并输出三个整点坐标,否则输出No. 注意如果存在输出的坐标必须在long long范围内. Input 第一行一个整数S(1<=S< ...

  9. EOJ Monthly 2018.11 猜价格 (模拟)

    分三种情况: 1.k=1.此时每次都说反话,反着二分即可. 2.1<k <= n.那么在前n次问答中一定会出现一次错误,通过不断输出1找出那个错误发生的位置(若回答是>那这就是错误) ...

随机推荐

  1. eclipse工具栏sdk和avd图标

    打开菜单Window -> Customize Perspective -> Command Groups Availability -> 勾选Android SDK and AVD ...

  2. Twitter网站架构分析介绍

    http://www.kaiyuanba.cn/html/1/131/147/7539.htm作为140个字的缔造者,twitter太简单了,又太复杂了,简单是因为仅仅用140个字居然使有几次世界性事 ...

  3. mysql truncate table命令使用总结

    truncate使用注意 由于上过truncate table a_table命令一次当,将教训记录下来,以示警戒!     mysql truncate table a_table命令受影响结果说明 ...

  4. iOS 摇一摇的实现

    - (void)viewDidLoad { [super viewDidLoad]; [[UIApplication sharedApplication] setApplicationSupports ...

  5. C# Select SelectMany 区别

    string[] text = { "Today is 2018-06-06", "weather is sunny", "I am happy&qu ...

  6. mysql + php 中文乱码 全是? 解决方法

    在my.ini文件中找到[client]和[mysqld]字段,在下面均加上default-character-set=utf8,保存并关闭,重启服务器 在window下重启失败,这是因为你安装了高版 ...

  7. 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 ...

  8. MVC入门——详细页

    添加Action ShowDetail using System; using System.Collections.Generic; using System.Linq; using System. ...

  9. 开源流媒体客户端EasyClient手机端控制摄像机EasyCamera云台PTZ控制实现

    本文转自EasyDarwin开源团队成员kim的博客:http://blog.csdn.net/jinlong0603/article/details/51835308 EasyCamera是Easy ...

  10. JavaScript精粹

    序:好书是需要不断品读的!再读语言精粹,顺便做点笔记. 1.NaN是一个数值,它表示一个不能产生正常结果的运算结果.NaN不等于任何值,包括它自己.检测是否为NaN:  isNaN(number). ...