头像

该用户被封禁

六年级蒟蒻/清华大学附属小学 小号:小朋友没有武德。 无条件互粉~




在线 


最近来访(1226)
用户头像
Dumby_cat
用户头像
zdczdc
用户头像
c++算法
用户头像
戟沉沙铁未
用户头像
Petit_Souris
用户头像
Yballul
用户头像
lyuacm
用户头像
老逗比小逗
用户头像
大雪莱
用户头像
本诉
用户头像
DemonAlpaca
用户头像
yans
用户头像
Hanson
用户头像
Archimedes
用户头像
Infinity_2
用户头像
shimao
用户头像
ikaqiu
用户头像
ghy
用户头像
hzt
用户头像
gaojiarui

新鲜事 原文

https://www.luogu.com.cn/team/37621


活动打卡代码 AcWing 1904. 奶牛慢跑

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 1e5 + 10, INF = 1e9 + 7;
int n, ans;
int s[N], v[N];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i ++ ) cin >> s[i] >> v[i];
    int k = INF;
    for (int i = n; i >= 1; i -- ) {
        if (v[i] <= k) {
            k = v[i];
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}


活动打卡代码 AcWing 1929. 镜子田地

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 1010;

int n, m;
char g[N][N];
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};

int dfs(int x, int y, int d) {
    if (x < 0 || x >= n || y < 0 || y >= m) return 0;

    if (g[x][y] == '/') d ^= 1;
    else d ^= 3;

    return dfs(x + dx[d], y + dy[d], d) + 1;
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i ++ ) scanf("%s", g[i]);

    int res = 0;
    for (int i = 0; i < n; i ++ ) {
        res = max(res, dfs(i, 0, 1));
        res = max(res, dfs(i, m - 1, 3));
    }

    for (int i = 0; i < m; i ++ ) {
        res = max(res, dfs(0, i, 2));
        res = max(res, dfs(n - 1, i, 0));
    }

    printf("%d\n", res);
    return 0;
}


活动打卡代码 AcWing 1922. 懒惰的牛

#include <iostream>
#include <cstring>
#include <algorithm>

#define x first
#define y second

using namespace std;

typedef pair<int, int> PII;
const int N = 100010;

int n, m;
PII q[N];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i ++ ) scanf("%d%d", &q[i].y, &q[i].x);
    sort(q, q + n);

    int res = 0, sum = 0;
    for (int i = 0, j = 0; i < n; i ++ ) {
        sum += q[i].y;
        while (q[i].x - q[j].x > m * 2) sum -= q[j ++ ].y;
        res = max(res, sum);
    }

    printf("%d\n", res);
    return 0;
}


新鲜事 原文

挑战全网最多踩!大家一起踩! https://www.acwing.com/file_system/file/content/whole/index/content/3619142/ https://www.acwing.com/file_system/file/content/whole/index/content/3619142/ https://www.acwing.com/file_system/file/content/whole/index/content/3619142/


活动打卡代码 AcWing Django-5.1. 上课笔记



活动打卡代码 AcWing 2058. 笨拙的手指

#include <iostream>
#include <cstring>
#include <algorithm>
#include <unordered_set>

using namespace std;

unordered_set<int> S;
string a, b;

int get(string a, int b) {
    int res = 0;
    for (auto c : a) 
        res = res * b + c - '0';
    return res;
}

int main()
{
    cin >> a >> b;
    for (auto& c : a) {
        c ^= 1;
        S.insert(get(a, 2));
        c ^= 1;
    }

    for (auto& c : b) {
        int t = c;
        for (int i = 0; i < 3; i ++ ) {
            if (i + '0' != t) {
                c = i + '0';
                int x = get(b, 3);
                if (S.count(x)) {
                    cout << x << endl;
                    return 0;
                }
            }
        }
        c = t;
    }
    return 0;
}


新鲜事 原文

AcWing《寒假每日一题2022》拼团优惠!https://www.acwing.com/activity/content/introduction/88/group_buy/39975/ AcWing《寒假每日一题2022》拼团优惠!https://www.acwing.com/activity/content/introduction/88/group_buy/39975/ AcWing《寒假每日一题2022》拼团优惠!https://www.acwing.com/activity/content/introduction/88/group_buy/39975/


活动打卡代码 Linux Django-4.1. 上课笔记

我配置好环境的网址:

http://101.42.226.63:8000/

我的项目地址:

https://git.acwing.com/winter2020/acapp



活动打卡代码 AcWing 3730. 寻找序列

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 110;

int n;
int a[4][N];

int main()
{
    int T;
    cin >> T;
    while (T -- )
    {
        cin >> n;
        for (int i = 0; i < 3; i ++ )
            for (int j = 0; j < n; j ++ )
                cin >> a[i][j];
        a[3][0] = a[0][0];
        for (int i = 1; i < n - 1; i ++ )
            for (int j = 0; j < 3; j ++ )
                if (a[3][i - 1] != a[j][i])
                {
                    a[3][i] = a[j][i];
                    break;
                }

        for (int i = 0; i < 3; i ++ )
            if (a[i][n - 1] != a[3][0] && a[i][n - 1] != a[3][n - 2])
            {
                a[3][n - 1] = a[i][n - 1];
                break;
            }
        for (int i = 0; i < n; i ++ ) cout << a[3][i] << ' ';
        cout << endl;
    }

    return 0;
}