跳到正文

n_ni

1014022

#include<iosteam>

在洛谷打开
资料、奖项与版本

资料

编号
1014022
抓取

奖项

2026 CSP-S
一等奖
2025 CSP-J
一等奖
2025 CSP-S
一等奖
2024 CSP-J
二等奖
2024 CSP-S
二等奖

版本

  1. v2当前
  2. v1
C++
#include<iosteam>
2379,4455,9250,10199,13379,15457,17248,20311\bold{2379,4455,9250,10199,13379,15457,17248,20311}

神秘剪贴板

tampermonkey

C++
#include<iostream>
#include<string>
using namespace std;
#define uchar unsigned char

uchar buf[1<<20];

void filecopy(string f1,string f2){
	FILE *ifp=fopen(f1.c_str(),"rb");
	FILE *ofp=fopen(f2.c_str(),"wb");
//	system("cls");
	getchar();
//	uchar *p1=buf,*p2=buf;
//	size_t tot=0;
	while(1){
		size_t cnt=fread(buf,1,1<<20,ifp);
		if(cnt==0)break;
		fwrite(buf,1,cnt,ofp);
//		tot+=cnt;
//		string s=to_string(tot)+" byte(s) data has been copied.";
//		setCursorPos(0,0);
//		cout<<s<<"\n";
	}
	cout<<"Completed.\n";
	getchar();
	fclose(ifp);
	fclose(ofp);
} 
C++
#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define uchar unsigned char

uchar buf[1<<20];

void copyfile(string f1,string f2){
	FILE *ifp=fopen(f1.c_str(),"rb");
	FILE *ofp=fopen(f2.c_str(),"wb");
	if(ifp==nullptr||ofp==nullptr)return ;
//	system("cls");
//	uchar *p1=buf,*p2=buf;
//	size_t tot=0;
	while(1){
		size_t cnt=fread(buf,1,1<<20,ifp);
		if(cnt==0)break;
		fwrite(buf,1,cnt,ofp);
//		tot+=cnt;
//		string s=to_string(tot)+" byte(s) data has been copied.";
//		setCursorPos(0,0);
//		cout<<s<<"\n";
	}
//	cout<<"Completed.\n";
	cout<<"[copyfile] "<<f1<<" "<<f2<<" \n";
	fclose(ifp);
	fclose(ofp);
} 

string gtl(){
	string res="";
	char ch;
	while((ch=getchar())&&ch!=EOF){
		if(ch=='\r')continue;
		if(ch=='\n')break;
		res+=ch;
	}
	return res;
}

void mkdir(string name){
	cout<<"[mkdir] "<<name<<"\n";
	string comm="mkdir \""+name+"\" > nul 2>nul";
	system(comm.c_str());
}

string hsh(string s){
	string x16="0123456789abcdef";
	string res="";
	for(int i=0;i<s.size();i++){
		res+=x16[(s[i]>>4)];
		res+=x16[(s[i]&15)];
	}
	return res;
}

void explorer(string path1,string path2){
	mkdir(path2);
	vector<string>dir;
	system(((string)"dir \""+path1+"\" /A-D /B > tmp 2>nul").c_str());
	freopen("tmp","r",stdin);
	string fn;
	while(1){
		fn=gtl();
		if(fn=="")break;
		copyfile(path1+"\\"+fn,path2+"\\"+fn); 
	}
	system(((string)"dir \""+path1+"\" /AD /B > tmp 2>nul").c_str());
	freopen("tmp","r",stdin);
	while(1){
		fn=gtl();
		if(fn=="")break;
		dir.push_back(fn);
	}
	for(auto fn:dir){
		explorer(path1+"\\"+fn,path2+"\\"+fn); 
	}
}

int main(){
	freopen("copy.log","w",stdout);
	string path1,path2;
	path1=gtl(),path2=gtl();
	explorer(path1,path2);
}

2025.12.16 红名祭

2026.4.16 在课后延时使用 3030min 从 11 数到 23792379 (?

共 3 篇
  1. 算法·理论

    O(W+q) 堆(离线)

    该文本描述了一种优化堆操作的算法思路,适用于元素值范围W较小的场景。核心步骤为: 将所有插入操作记录为序列a,对a进行升序排序(采用桶排序而非普通排序以保持O(W)时间复杂度) 维护一个链表结构,记录每个元素在堆中的有效状态 对于每个a_i,若其未被删除且当前堆顶元素大于a_i,则更新该时刻的最小值m_j为a_i 通过链表跳过已被删除的元素,将时间复杂度从O(q²)优化至O(W+q) 该方法的关键在于利用桶排序降低初始排序的复杂度,并通过链表结构避免重复检查已被删除的元素,但受限于W的大小,当元素值范围过大时该优化策略将失效。

  2. 科技·工程

    minesweeper更新日志

    代码 -1.x 未开发完全。 -1.2.0之前没有更新日志。 -1.2.0 2025/11/22 11:55 更新了更新日志(?)。 修改了生成游戏时会死循环的bug。 更改了菜单的键位。 将编译器的版本变为C++14(实际上这是-1.0.1的内容)。

  3. 题解

    题解:AT_abc366_c [ABC366C] Balls and Bag Query

    该问题要求处理对袋子中球种类的操作,包括添加、移除和查询当前种类数。通过使用数组f记录每种球的数量,并维护一个变量sum统计存在种类数,可高效解决。具体方法为: 操作1 x:若f[x]为0,则sum++,随后f[x]++; 操作2 x:f[x]--后,若f[x]变为0,则sum--; 操作3:直接输出sum。 此方法时间复杂度为O(N),满足数据范围要求,且代码简洁高效。