Deque

toi_la_ai

À mình hiểu rồi, thật ra cách làm của bạn không cần dùng đến Deque và hơn nữa nó thực chất là kĩ thuật trượt cửa sổ 😉

...Xem thêm

Deque

ducbao_

mình nhớ mình ac trong contest mà ?

...Xem thêm

Biểu thức lớn nhất (THTB Sơn Trà 2022)

wibulordsama

ụa dùng segment tree bị mle :(((

...Xem thêm

J4F #04 - Wrong Answer

lvnhatquang1212

I don't comment 'Tui là người đầu tiên upvote'


🤔🤔🤔

...Xem thêm

Tổng chẵn

lvnhatquang1212
k = int(input()) // 2
print(k * (k + 1))
...Xem thêm

Sắp xếp ba số

lvnhatquang1212

Code 'Lua':

a = tonumber(io.read())
b = tonumber(io.read())
c = tonumber(io.read())

if a > b then a, b = b, a end
if a > c then a, c = c, a end
if b > c then b, c = c, b end

print(a, b, c)

...Xem thêm

Cánh Diều - REPLACE - Thay thế

lvnhatquang1212

Code ngôn ngữ 'lua'

q = tonumber(io.read())

for i = 1, q do
    y = io.read()
    a = io.read()
    b = io.read()

    pat = a:gsub("(%W)", "%%%1")
    res = y:gsub(pat, b)

    print(res)
end
...Xem thêm

Tính tổng

tranhuongchubb1508

include <iostream>

using namespace std;
int main() {
long long n;
cin >> n;
long long ssh = ((n - 1) / 1)+ 1;
long long s = ((1 + n) * ssh) / 2;
cout << s;
}

...Xem thêm

Tính tổng

tranhuongchubb1508

include <iostream>

using namespace std;
int main() {
long long n;
cin >> n;
long long ssh = ((n - 1) / 1)+ 1;
long long s = ((1 + n) * ssh) / 2;
cout << s;
}

...Xem thêm

Tìm số (THTA Lâm Đồng 2022)

phuckidpython15

Tại sao sai vậy mọi người

Code mẫu WA (70.0/100 điểm)

n = int(input())
if n % 10 > 0 and n % 10 < 6:
print (n * 2 - 1)
else:
print (n * 2 - 2)

...Xem thêm

KNTT10 - Trang 126 - Luyện tập 1

Bui_Dang_Phuc

C++ AC ( •̀ ω •́ )✧

// C++ mẫu lập trình thi đấu

#include<bits/stdc++.h>
#define ll long long
using namespace std;

vector<string>split(string str, char removeChar = ' '){
    string subStr = "";str+=removeChar;
    vector<string> strSplited;

    for(char&x : str){
        if(x == removeChar && subStr != "")strSplited.push_back(subStr), subStr.clear();
        else subStr+=x;
    }

    return strSplited;
}

double str_Double(string str){
    double num = 0;

    for(ll i = 0;i < str.size();i++){
        if(str[i] == '.'){
            double phanThapPhan = 0.0;
            for(ll j = str.size()-1;j > i;j--){
                phanThapPhan+=str[j]-48;
                phanThapPhan*=0.1;
            }
            num+=phanThapPhan;break;
        }

        num = num*10 + (str[i]-48);
    }

    return num;
}

vector<double>strVT_DoubleVT(vector<string>strs){
    vector<double>nums;

    for(string&x : strs){
        nums.push_back(str_Double(x));
    }

    return nums;
}

double sum(vector<double> nums){
    double result = 0;

    for(double&x : nums)result+=x;

    return result;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    string nums;getline(cin, nums);

    cout << sum(strVT_DoubleVT(split(nums)));

    return 0;
}
...Xem thêm

CSES - Maximum Xor Subarray | Đoạn con có xor lớn nhất

nongducquan
Hint

2 số xor max khi là đảo bit của nhau => duyệt bit từ trái qua phải ưu tiên chọn số có bit đối với bit hiện tại

Hint

f[i] = a[1]^a[2]^..^a[i]
=> kq = max(f[i]^f[j])

...Xem thêm

Report

cattuong1903

bé này chép code chatgpt nekk, link : file:///C:/Users/pc/Desktop/%E1%BA%A3nh/%E1%BA%A3nh%202/Capture.PNG

...Xem thêm

Report

cattuong1903

hỏi bài chatgpt thoy đc ko add

...Xem thêm

Nốt nhạc

Bảo_Đẹp_Trai

Bài này cho k điểm kkk

...Xem thêm