9.11考试总结

# 9.11考试总结

细胞分裂

数学题目,因式分解后直接判断输入数据是否含有m1中分解出来的数,然后储存需要时间最大值中的最小值

#include<bits/stdc++.h>
#define open(s) freopen(s".in", "r", stdin);// freopen(s".out", "w", stdout);
#define IL inline
#define ull unsigned long long
#define ll long long
using namespace std;

int n, m1, m2;
int a;
int maxb, lenb;
int b[30010];
struct date
{
    int su, add;
}d[30010];
int lend;

IL int read();
IL void cut(int);
IL void cutt(int);

int main()
{
    open("cell");
    n = read(); m1 = read(); m2 = read();
    cut(m1);
    if (m1 == 1)
    {
        cout << "0" << endl;
        return 0;
    }
    int ans = 999999999;
    for (int i=1; i<=n; ++i)
    {
        a = read();
        int temp = -1;
        for (int j=1; j<=lend; ++j)
        {
            if (a%d[j].add)
            {
                temp = -1;
                break;
            }
            int sum = 0;
            while (!(a%d[j].add))
            {
                sum++;
                a /= d[j].add;
            }
            sum = ceil(d[j].su*1.0/sum);
            temp = max(temp, sum);
        }
        if (temp != -1)
            ans = min(ans, temp);
    }
    if (ans == 999999999)
        cout << "-1";
    else cout << ans;
    cout << endl;
    return 0;
}

void cut(int x)
{
    lend = 0;
    for (int i=2; i*i<=x; ++i)
    {
        if (!(x%i))
        {
            lend++;
            d[lend].add = i;
            d[lend].su = 0;
            while (!(x%i))
            {
                d[lend].su++;
                x /= i;
            }
            d[lend].su *= m2;
        }
    }
    if (x != 1)
    {
        d[++lend].add = x;
        d[lend].su = m2;
    }
}

int read()
{
    int i = 1, j = 0;
    char x = getchar();
    while (x < '0' || '9' < x)
    {
        if ('-' == x) i = -1;
        x = getchar();
    }
    while ('0' <= x && x <= '9')
    {
        j = j * 10 + x - '0';
        x = getchar();
    }
    return i*j;
}

这道题在考试的时候没有找到最优化的方法导致复杂度超高,然后re

导弹拦截

说是一道贪心题目,实际跟暴力枚举没有什么区别。现将最开始的情况直接全部分配给第一个系统并且要从大到小排序,在逐步枚举分配给第二个系统的截止位置。记录最小答案即可

#include<bits/stdc++.h>
#define open(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define IL inline
#define ull unsigned long long
#define ll long long
using namespace std;

int ax, ay, bx, by;
int n, k = 1;
int xx[100010], yy[100010];
struct date
{
    int x, y;
}a[100010];

IL int read();
IL int max(int, int);
IL bool cmp(date, date);

int main()
{
//  open("missile");
    ax = read(); ay = read(); bx = read(); by = read();
    n = read();
    for (int i=1; i<=n; ++i)
    {
        int x, y;
        x = read(), y = read();
        a[i].x = (ax - x) * (ax - x) + (ay - y) * (ay - y);
        a[i].y = (bx - x) * (bx - x) + (by - y) * (by - y);
    }
    sort(a+1, a+1+n, cmp);
    int i=2,r1=a[1].x,r2=0;
    int minn = r1 + r2;
    while (i <= n)
    {
        r1 = a[i].x;
        r2 = max(r2, a[i-1].y);
        minn = min(minn, r1+r2);
        i++;
    }
    cout << minn << endl;
    return 0;
}

bool cmp(date x, date y)
{
    return x.x > y.x;
}

int max(int x, int y)
{
    return x > y ? x : y;
}

int read()
{
    int i = 1, j = 0;
    char x = getchar();
    while (x < '0' || '9' < x)
    {
        if ('-' == x) i = -1;
        x = getchar();
    }
    while ('0' <= x && x <= '9')
    {
        j = j * 10 + x - '0';
        x = getchar();
    }
    return i*j;
}

这个题目直接贪心好像有一定的问题存在。所以必须保证平方和最小,而不是单个系统的最值问题

三国游戏

因为机器总是被动防守,所以总是选择不到大的值,而最大值的另外的搭配总是先被机器选走。所以人只能拿到次大,就直接寻找每一组搭配的次大值就可以了

#include<bits/stdc++.h>
#define open(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define IL inline
#define ull unsigned long long
#define ll long long
using namespace std;

int n;
int a[510][510];

IL int read();
IL bool cmp(int x, int y)
{
    return x > y;
}

int main()
{
    //open("sanguo");
    int maxn = -1, addj;
    n = read();
    for (int i=1; i<=n; ++i)
        for (int j=i+1; j<=n; ++j)
            a[i][j] = a[j][i] = read();
    int ans = 0;
    for (int i=1; i<=n; ++i)
    {
        sort(a[i]+1, a[i]+n+1, cmp);
        maxn = max(maxn, a[i][2]);
    }
    cout << "1" << endl;
    cout << maxn << endl;
    return 0;
}

int read()
{
    int i = 1, j = 0;
    char x = getchar();
    while (x < '0' || '9' < x)
    {
        if ('-' == x) i = -1;
        x = getchar();
    }
    while ('0' <= x && x <= '9')
    {
        j = j * 10 + x - '0';
        x = getchar();
    }
    return i*j;
}

原文地址:https://www.cnblogs.com/rendex/p/9636330.html

时间: 2024-08-30 00:56:56

9.11考试总结的相关文章

10.11考试总结

10.11考试总结 全是DP实际上发现暴力也能有部分分....... 三角形牧场 DP......当时总是感觉不像啊 需要处理的就是枚举三角形边长可能出现的情况.因为周长在输入端时候就可以确定了,所以只需要通过枚举两条边就可以强行算出第三条边..... 所以就省空间+时间.... f[0][0] = 1; for (int i=1; i<=n; ++i) for(int j=half; j>=0; j--) for(int k=j; k>=0; k--) if(j >= d[i]

6.11 考试修改+总结

第三题至今没敢写,感觉好恐怖QAQ 今天考得好糟糕 第一题只写了10分的暴力+(k=1)20分的网络流 后来题解告诉我k>1的时候可以分治到k=1,每层分治解决方法是同k=1的 考试的时候没有注意到2^k这个比较神奇的可以分治的性质 而且自己考场上丝薄了,没有发现因为是二分图可以直接跑欧拉回路的性质,而是裸套网络流模型 第二题其实已经接近想出了题解 自己考试的时候成功证明了暴力的复杂度是线性的 但是没有想到如何寻找0-1对,然后就只能暴力用Splay维护1所在的位置了 默默祈祷数据不要太卡我的做

[题解] 8.11考试 水渠

题目描述 把n+m个点分为两列,第一列有n个点,第二列有m个点. 每一列的点的横坐标相同,给这些点连边,将这n+m个点全部连通,求所连边的最小总和. 输入格式 第一行四个整数n,m,x1,x2,分别表示第一列的点数,第二列的点数,第一列中点的横坐标,第二列中的点的横坐标. 第二行n个正整数y1[1],y1[2],...,y1[n],表示第一列中的点的纵坐标. 其中,第一个数表示第一个点的纵坐标,接下来的数表示当前点与前一个点的纵坐标差. 第三行有m个正整数,意义同上. 输出格式 一个实数,为边的

2020.1.11考试总结

恭贺 treAKer 在毒瘤之神的考验一题中rank1,成为新一届毒瘤之神! ...... 结果今天就考了 treAKer 的毒瘤题... T1 考场上看到1e6就想O(n)的做法,结果失败了... 正解思路很神奇,就是先对物品按照a来排序,询问按照m来排序,用双指针一起扫,同时维护\(f_i\) 当物品的和为i时 在所有的方案中,最小的b最大 的方案中的 b值.判一下\(f_i\)和m+s的大小关系即可. #include<algorithm> #include<cstring>

cisco learn book index

------------------------------------------------------------------ Routing TCP/IP Volume 1 , Second Edition ------------------------------------------------------------------ Routing TCP/IP Volume 2 ---------------------------------------------------

基于web的数字化校园管理集成方案

软件系列 :基于web的数字化校园管理集成方案 开发公司: 慈溪市顺通网络技术有限公司 开发时间:2013/5/21 1. 引言 1.1编写目的 1.2项目背景 2.总体设计说明: 3. 系统概述 3.1系统建设目标 3.2系统功能 4.系统使用说明 4.1登录界面 4.1登录界面 4.2权限设置-个人权限 4.3学年管理 4.4学期管理 4.5年级管理 4.6班级管理及维护 4.61添加班级 4.62批量添加班级 4.63班级维护 4.64班级升迁设置 4.65班级升迁 4.66升迁管理 4.

阿里云ACP云计算认证分享--从零基础到拿证15天

2019年1月9号之前从未接触过阿里云,也对阿里云认证兴趣不大.只是浅浅的知道阿里云已经占有国内50%的公有云市场了.当天有同事聊说,阿里云这部分市场还不错,可以尝试学学.2019年1月10号,登录阿里云官网看看认证课程,云计算分为ACA.ACP和ACE.官网考试费分别是1200.1200和1920.因为本人已经获得CCIE RS和RHCE证书,肯定会朝着最高的ACE去考.ACA考试最低级的,不考虑.ACE是最终的目标,但是必须先考完ACP才可以报名ACE.想要深知这块内容,考证无非是最好的方式

百度回复将按时缴费卡水立方

http://www.ebay.com/cln/ch.y908/-/176925541016/2015.02.11 http://www.ebay.com/cln/shaamjson/-/176833416018/2015.02.11 http://www.ebay.com/cln/x_ru421/-/176666486019/2015.02.11 http://www.ebay.com/cln/hua6592_18usz/-/176835881012/2015.02.11 http://www

百度回房间撒饭卡上付款了

http://www.ebay.com/cln/jiayi49/-/176913237014/20150211 http://www.ebay.com/cln/rua.w87/-/176774153017/20150211 http://www.ebay.com/cln/y-d4507/-/176894466012/20150211 http://www.ebay.com/cln/zhoncn-v3pn4thx/-/176983648016/20150211 http://www.ebay.co