跳到正文

Atimmy

951510

abl

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

资料

编号
951510
抓取

奖项

2024 CSP-J
一等奖

ABNER·LIN 林田日麦子


给~~~~CCF~~~~ 打钱20万求NOI名额(bushi

Lindian·Abner·Ninrater

YOU Know I’m a SAVAGE

为什么制作蓝LED几乎是不可能的

【BIBI金亨瑞】不看这个MV你会损失全宇宙《Animal Farm》MV无码 硬核默片

抖音:点这里!(别忘了关注我 =D )

分享CF962A Equator:目前做过最多测试点的题

https://www.acwing.com/activity/content/11/

人总是贪婪的,就像最开始,我也只是想知道你的名字。
在我胡思乱想的所有事情中,唯独喜欢你这件事,不是白日做梦

十年 OI一场空,不开long long见祖宗


《只因》                                                                                                       \huge《只因》~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

啊啊啊我做出来了人生的第一道普及-(尖叫)!!!

———————————————————————2023.12.30

绿了,都绿了!!!

———————————————————————2024.02.05

第一道黄题(普及/提高-)!!!

———————————————————————2024.02.08

钻空子(暂无评定)!!!

———————————————————————2024.02.14

《绿绿忽若林田》(普及+/提高)!!!

———————————————————————2024.02.20


REVENGE\mathbb{R}\mathbb{E}\mathbb{V}\mathbb{E}\mathbb{N}\mathbb{G}\mathbb{E} 我∥?我 \parallel ? 迎面走来的你让我如此蠢蠢欲动{\color{maroon}迎面}{\color{red} 走来} {\color{orange} 的 } {\color{gold}你让} {\color{yellow} 我 } {\color{greenyellow}如此 }{\color{lawngreen} 蠢蠢 }{\color{aquamarine}欲动 } 这种感觉我 从未有{\color{green}这种感觉} \Huge\textit{\color{azure}我 }\LARGE{\color{cyan}从未} {\color{blue}有 } Cause I got a crush on you who you{\color{purple}Cause~}{\color{violet}I ~got ~a}{\color{pink}~crush }{\color{brown} ~on }{\color{Tan}~you}{\color{khaki} ~who }{\color{silver}~you }

Atimmy的练习情况 020,026,031,053,065,066,069,070,073,075,076,078,079,085,087,090,091,093,095,096,097,098 Atimmy的基本信息

oi

孤身一人沉寂{\color{violet}孤身一人沉寂} 重启星途勇气{\color{violet}重启星途勇气} 不改心中坚定{\color{violet}不改心中坚定} JINI 出道快乐{\color{purple}JINI~出道快乐}

vector
C++
//STL<vector>
#include <iostream>
#include <vector>//动态数组 
#include <algorithm>
using namespace std;

bool cmp(int a,int b)
{
	return a>b;
} 

int main()
{
	
	//vector<int>a(15);//默认值为0 
	//vector<int>a(15,114514);//15个114514 
	//vector<int>a{1,2,3,4,5};//初始化1,2,3,4,5 (c++11后才有)
	vector<int>a({11,2,30,-4,5});//这也是对的 
	
	a.push_back(666);//添加 
	for(int i=0;i<a.size();i++)
		cout<<a[i]<<" ";

	a.pop_back();//删除末尾元素 
	for(int i=0;i<a.size();i++)
		cout<<a[i]<<" ";

	cout<<a[a.size()-1]<<endl;//末尾元素 
	cout<<a.back()<<endl;//末尾元素 

	cout<<a[0]<<endl;//第一个元素 
	cout<<a.front()<<endl;//第一个元素 
	
	sort(a.begin(),a.end());//a.end()是最后一个位置+1,为空 
	sort(a.begin(),a.end(),greater<int>());
	
	for(int s:a)//for(auto x:a)自动识别 
	{
		cout<<s<<endl;//遍历数组 (c++11后才有)
	} 
	
	vector<int>::iterator p=a.begin();//迭代器,p:指针 
	p++;//指向下一个元素 
	cout<<*p<<endl;
	
	reverse(a.begin(),a.end());//反转数组 
	
	cout<<"_________________________________________"<<endl;
	
	a.erase(a.begin()+1);//把下标为1的元素删掉 
	for(int x:a)
	{
		cout<<x<<endl;
	}
	
	a.clear();//清空 
	//en.cppreference.com
	//zh.cppreference.com
	return 0;
}

————————————————————————————————分隔符

map
C++
#include <iostream>
#include <map>
using namespace std;
int main()
{
	map<string,int>mp;//函数   映射(人名,成绩)
	mp["zhangsan"]=99;
	mp["lisi"]=95;
	mp["wangwu"]=80;
	
	cout<<mp["lisi"]<<endl;
	cout<<"mp.size:"<<mp.size()<<endl;
	
	cout<<mp["zhangbailiang"]<<endl;//不会报错,会得到0
	cout<<"mp.size:"<<mp.size()<<endl;// ↑增加一条数据 
	
	mp.insert({"ikun",100});//插入数据 
	mp.insert({"ikun",10});//遇到重复的值时忽略,因为一个人名只能对应一个成绩  
	cout<<mp["ikun"]<<endl;
	
	mp["jiangwenxi"]=120230002;
	mp["jiangwenxi"]=5;//遇到重复的值时更新  
	cout<<mp["jiangwenxi"]<<endl;
	
	cout<<mp.count("yanlingxuan")<<endl;//数一数里面有多少个“yanlingxuan” 
	//因为函数的人名不能重复,所以count要么得到0,要么得到1 
	cout<<"_____________________________________"<<endl;
	
	
	for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++)//输出map所有的元素(字典序排列) 
	{
		cout<<it->first<<" "<<it->second<<endl;//c++11前  
	}
	cout<<"_____________________________________"<<endl;
	
	
	//for(auto it=mp.begin();it!=mp.end();it++) 
	
	//        ↓auto 
	for(pair<string,int> p:mp)//c++11后 
	{
		cout<<p.first<<' '<<p.second<<endl;//输出人名和得分 
	}
	cout<<"______________________________________"<<endl;
	
	for(auto [name,score]:mp)//c++17后 
	{
		cout<<name<<' '<<score<<endl;//输出人名和得分 
	}
	mp.erase("ikun");//删除元素  
	
	auto it=mp.find("ikun");//找到ikun的位置 
	mp.erase(it);//迭代器删除 
	auto it=mp.lower_bound("x");
	cout<< it->first<<' '<<it->second <<endl;
	return 0;
} 

引用
C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x=10;
	int &y=x;//y引用x
	y=12;
	cout<<x<<" "<<y<<endl;
	return 0;
} 

C++
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long LL;
int main()
{
	stack<int> stk;//创建栈 
	stk.push(90)//向栈中加入一个数 
	stk.pop()//将栈顶弹出 
	cout<<stk.top()<<endl;//输出栈顶 
	cout<<stk.size()<<endl;//输出此时站内元素个数 
	stk.empty()//空栈就返回一 
	ios::sync_with_stdio(false);cin.tie(0);//优化cin
	//sync:同步 
	return 0;
}

/////

C++
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;

void solve()
{
	stack<ULL> stk;
	int n;
	cin>>n;
	string s;
	while(n--)
	{
		cin>>s;
		if(s=="push")
		{
			ULL x;
			cin>>x;
			stk.push(x);
		}
		else if(s=="query")
		{
			if(stk.empty())
			{
				cout<<"Anguei!"<<endl;
			}
			else
			{
				cout<<stk.top()<<endl;
			}
		}
		else if(s=="pop")
		{
			if(stk.empty())
			{
				cout<<"Empty"<<endl;
			}
			else
			{
				stk.pop();
			}
		}
		else
		{
			cout<<stk.size()<<endl;
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int T;
	cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}

/////

C++
//【例2-1】周末舞会
#include <bits/stdc++.h>
using namespace std;
int n,m,x;
int q1[100005],q2[100005];
int main()
{
	cin>>n>>m>>x;
	for(int i=0;i<n;i++)
	{
		q1[i]=i+1;
	}
	for(int i=0;i<m;i++)
	{
		q2[i]=i+1;
	}
	int t1=0,t2=0,cnt=0;
	while(cnt<x)
	{
		cout<<q1[t1]<<" "<<q2[t2]<<endl;
		cnt++;
		t1=(t1+1)%n; 
		t2=(t2+1)%m; 
	}
	return 0;
}

/////

C++
//【例2-2】Blah数集
#include <bits/stdc++.h>
using namespace std;
int q[1000020],t,p2,p3;
int a,n;
void m()
{
	t=1;
	q[1]=a;
	p2=p3=1;
	while(t<=n)
	{
		int x2=2*q[p2]+1,x3=3*q[p3]+1;
		if(x2<x3)
		{
			t++;q[t]=x2;
			p2++;
		}
		else if(x2>x3)
		{
			t++;q[t]=x3;
			p3++;
		}
		else
		{
			t++;
			q[t]=x2;
			p2++;p3++;
		}
	}
	cout<<q[n]<<endl;
}
int main()
{
	while(cin>>a>>n)
	{
		m();
	}
	return 0;
}
C++
#include <bits/stdc++.h>
using namespace std;
int m,ci,sm,h,t;
int p[1009];
int main()
{
	cin>>m>>ci;
	for(int i=0;i<ci;i++)
	{
		int x;
		cin>>x;
		bool oo=0;
		for(int j=h;j<t;j++)
		{
			if(p[j]==x)
			{
				oo=1;
				break;
			}
		}
		if(oo)
		{
			sm++;
			if(t-h==m)
			{
				h++;
			}
			p[t]=x;
			t++;
		}
	}
	cout<<sm;
	return 0;
}//这个为什么错了?
C++
#include <iostream>
using namespace std;
const int N = 1010;
int q[N], hh, tt;
int m, n;
int main() {
	cin >> m >> n;
	hh = tt = 0;
	int ans = 0;
	while (n--) {
		int x;
		cin >> x;
		bool flag = false;
		for (int i = hh; i < tt; i++) {
			if (q[i] == x) {
				flag = true;
				break;
			}
		}
		if (flag == false) {
			ans++;
			if (tt - hh == m) {
				hh++;
			} 
			q[tt] = x; tt++;
		} 
	}
	cout << ans << endl;
	return 0;
}//这个为什么对了?
C++
//分解质因子
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int j=2;j<=n;j++)
	{
		int k=j;
		cout<<k<<"=";
		int i=2;
		while(k!=1)
		{
			while(k%i==0)
			{
				k=k/i;
				cout<<i;
				if(k!=1)
				cout<<"*";
			}
			i++;
		}
		cout<<endl;
	} 
	return 0;
}



2024.03.30城阳一中c++(while循环)学习例题

与7无关的数

C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int m;
	cin>>m;
	long long sum=0;//统计平方和 
	bool f;//判断是否与7有关 
	for(int i=1;i<=m;i++)//从1到m中找与7无关的数 
	{
		int j=i;//遍历,防止i的值改变 
		if(j%7==0)f=true;//和7有关 
		else
		{
			f=false;//暂定和7无关 
			while(j!=0)
			{
				if(j%10==7)f=true;break;//和7有关 
			}
			j/=10;//逐一检查数位看看是不是7 
		}
		if(f==false)//当这个数与7无关的时候 
		{
			sum+=i*i;//加上平方和 
		}
	}
	cout<<sum;
	return 0;
}//一个正整数,如果它能被7整除,或者十进制下它的某一位是7,则称它是与7有关的数,现给定一个n,求出小于等于n的正整数中,与7无关的数的平方和。

一个数里不同的质因子个数

C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int i=2,geshu=0;
	while(n>1)//当n大于1时重复判断 
	{
		if(n%i==0)//判断i是不是n的质因子 
		{
			geshu++;
			while(n%i==0)//重复算到n不能整除i 
			{
				n=n/i;
			}
		}
		i++;
	}
	cout<<geshu;
	return 0;
}//给定一个n,求出n的不同质因子的个数。

反转数位和

C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int he=0;
	while(n!=0)//拆位求和(和为he) 
	{
		he+=n%10;
		n/=10;
	}
	//然后将he翻转输出 
	int x=0;
	while(he!=0)
	{
		x=x*10+he%10;
		he/=10;
	}
	cout<<x;
	return 0;
 }//给定一个n,求出n的各位数字之和,并将这个和翻转后输出。

寻找最大值

C++
#include <bits/stdc++.h>
using namespace std;
int mi=INT_MIN;//整数int类型的最小值常量(new知识点) 
int main()
{
	int n;
	cin>>n;
	while(n!=0)
	{
		if(n>mi)
			mi=n;
		cin>>n; 
	}
	cout<<mi;
	return 0;
}//输入一些正整数,输出这些数的最大值,读入以0为结束标志。

阶乘之和

C++
#include <bits/stdc++.h>
using namespace std;
long long sum;//阶乘之和 
int main()
{
	int n;
	cin>>n;
	int j=1;
	while(sum<=n)
	{
		long long jc=1;//阶乘
		for(int i=1;i<=j;i++)
		{
			jc=jc*i;
		}
		sum+=jc;
		j++;
	}
	cout<<j-1;
	return 0;
}//定义i!=1*2*3*…*i,现在给你一个正整数n,你的任务是求出一个最小的j,使得1!+2!+3!+…+j!>n
C++
//输入升序排列的10个数字,输入一个数字,插入这10个数字里,保证升序排列
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[15],b[15],n,t;
	for(int i=0;i<10;i++)
		cin>>a[i];
	cin>>n;
	for(int i=0;i<11;i++)
	{
		if(a[i]>n)
		{
			t=a[i];
			a[i]=n;
			n=t;
		}
	}
	for(int i=0;i<11;i++)
		cout<<a[i]<<" ";
	return 0;
} 
C++
#include <bits/stdc++.h>
using namespace std;
int x;
int jc(int x)
{
	return x==0 ? 1 : x*jc(x-1);//三元运算符
}
int main(){
	cin>>x;
	cout<<jc(x);
	return 0;
}

还没有收录这位用户的文章。