50代码求调

写了好多个代码,都是50的;

换了好多方法了....

求调!!!

//
// Created by HASEE on 2024/5/9.
//



/*** remain true to the original aspiration ***/
#include<bits/stdc++.h>

using namespace std;

//#pragma GCC optimize(2)
//#pragma G++ optimize(2)

#define pli pair < li , li >
#define ll long long
#define li long long
#define int long long
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define Test           ll ___;read(___); while(___--)
#define pb             push_back
#define all(x)         (x).begin(),(x).end()
#define fi             first
#define se             second
#define Faster         ios_base :: sync_with_stdio( 0 ); cin.tie( 0 ); cout.tie( 0 );
#define YES            printf("YES\n");
#define Yes            printf("Yes\n");
#define NO             printf("NO\n");
#define No             printf("No\n");
int mod = 1e9 + 7;
#define gcd(a, b)     __gcd( a , b )
#define lcm(a, b)     ( a * ( b / gcd( a , b ) ) )
#define popcount(x)    __builtin_popcount(x)
#define string(x)      to_string(x)
int dx[] = {-1, 0, 0, 1, 0};//下左右上
int dy[] = {0, -1, 1, 0, 0};
int dx1[] = {-1, -1, -1, 0, 1, 0, 1, 1, 0};//左下 中下 右下 左 中 右 左上 中上 右上
int dy1[] = {-1, 0, 1, -1, 1, 1, -1, 0, 0};
int dx2[] = {-2, -2, -1, -1, 1, 1, 2, 2};
int dy2[] = {-1, 1, -2, 2, -2, 2, -1, 1};

const ll INF = 0x3f3f3f3f;
const double PI = 3.141592653589793238462643383279;

ll powmod(ll a, ll b) {
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}

ll square(ll x1, ll y1, ll x2, ll y2) { return abs(x2 - x1) * abs(y2 - y1); }

ll get_dist(ll x1, ll y1, ll x2, ll y2) { return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); }

ll get_jiao(ll x1, ll y1, ll x2, ll y2, ll x3, ll y3, ll x4, ll y4) {
    int n1 = max(min(x1, x2), min(x3, x4)), m1 = max(min(y1, y2), min(y3, y4)), n2 = min(max(x1, x2),
                                                                                         max(x3, x4)), m2 = min(
            max(y1, y2), max(y3, y4));
    if (n2 > n1 && m2 > m1)return (n2 - n1) * (m2 - m1); else return 0;
}

template<typename T>
inline bool read(T &x) {
    x = 0;
    int f = 1;
    char c = getchar();
    bool ret = false;
    while (c < '0' || c > '9') {
        if (c == '-')f = -1;
        c = getchar();
    }
    while (c <= '9' && c >= '0') {
        x = (x << 1) + (x << 3) + (c ^ 48);
        c = getchar();
        ret = true;
    }
    x = x * f;
    return ret;
}

template<typename T, typename... Args>
inline bool read(T &a, Args &...args) { return read(a) && read(args...); }

template<typename T, typename Type>
inline void print(T x, const Type type) {
    if (x < 0)putchar('-'), x = -x;
    if (x > 9)print(x / 10, 0);
    putchar(x % 10 ^ 48);
    if (type == 1)putchar(' '); else if (type == 2)putchar('\n');
}

template<typename T, typename Type, typename... Args>
inline void print(T x, const Type type, Args... args) {
    print(x, type);
    print(args...);
}
//#define rint register int
#define rint int
#define rep(i, i0, n)for(rint i=i0;i<=n;i++)
#define per(i, in, i0)for(rint i=in;i>=i0;i--)
#define itn int
#define PII pair<int ,int >
///______________________ L E T ' S  B E G I N _____________________

int vis[3601] = {};
//int f[3601] = {};
int a[1000007] = {};

signed main() {

    Test {
//        memset(f,0,sizeof f);
        int n;
        bitset<7000> f;
        read(n);
        rep(i,1,n)read(a[i]),a[i]%=3600;
        if(n>=3600)YES
        else{
            f[0]=1;
            rep(i,1,n)
                f|=f<<a[i];
            if(f[3600])YES
            else
                NO
        }
    }
}

全部评论

相关推荐

07-14 12:29
门头沟学院 Java
后端岗,实习三周感觉有点想跑路了,担心秋招被拉黑,有没有佬是字节HR知道情况的
从零开始的转码生活:你实习三周都想跑路,将来拿到offer真的愿意在这干十几二十年吗
投递字节跳动等公司8个岗位
点赞 评论 收藏
分享
Hakasee:我的简历和你的基本一样,上周去了上海,boss投了三百家, 三家线下面试 第一家没有做题,全是八股和项目,因为第一次面试不怎么熟练,挂了 第二家,给你几个题目(①css垂直居中文字,字体每两秒闪烁一下以及点击弹窗,②给你一个链接,实现可视化地图,③然后是八股,图片性能优化,以及对图片app有什么想法),45分钟内做完,然后老板面试) 第三家特别偏僻,有点阴森,到了之后让了一个工位给我,有四个题目,①格式化时间 年月日当前时间星期几② 正则表达式提取新闻文字,③在文本域输入文字生成选择题以及选项④生成商品排版还是什么来着 三家都是不超过50人的小公司 两家线上牛客笔试(卡伦特,七牛云,但是笔试不仅要考前端,还要考后端,算法,甚至数学题 我的建议是如果只做了这两个vue项目且不怎么熟练的情况下,先沉淀沉淀,把react学了,上海好的公司基本都是react查看图片
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务