08-25-2025
This commit is contained in:
		
							
								
								
									
										19
									
								
								Luogu/CodeOverclock/P1059 [NOIP 2006 普及组] 明明的随机数.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Luogu/CodeOverclock/P1059 [NOIP 2006 普及组] 明明的随机数.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <set>
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					int main(){
 | 
				
			||||||
 | 
						set<int> s;
 | 
				
			||||||
 | 
						int n;
 | 
				
			||||||
 | 
						cin >> n;
 | 
				
			||||||
 | 
						int tmp;
 | 
				
			||||||
 | 
						for(int i = 0; i < n; i++){
 | 
				
			||||||
 | 
							cin >> tmp;
 | 
				
			||||||
 | 
							s.emplace(tmp);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						cout << s.size() << endl;
 | 
				
			||||||
 | 
						for(auto it = s.begin(); it != s.end(); it++){
 | 
				
			||||||
 | 
							cout << *it << " ";
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						cout << endl;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										0
									
								
								Luogu/CodeOverclock/P1062 [NOIP 2006 普及组] 数列.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								Luogu/CodeOverclock/P1062 [NOIP 2006 普及组] 数列.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -1,17 +1,14 @@
 | 
				
			|||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
int main(){
 | 
					int main(){
 | 
				
			||||||
	int n,k;
 | 
						int n, k;
 | 
				
			||||||
	cin>>n>>k;
 | 
						cin >> n >> k;
 | 
				
			||||||
	int tmp=n;
 | 
						int tmp = n;
 | 
				
			||||||
	int js=n;
 | 
						int js = 0;
 | 
				
			||||||
	while(tmp>k){
 | 
						while(tmp >= k){
 | 
				
			||||||
		js+=int(tmp/k);
 | 
							tmp = tmp - k + 1;
 | 
				
			||||||
		tmp=tmp%k+tmp/k;
 | 
							js++; 
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	cout<<js<<endl;
 | 
						cout << n + js << endl;
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
/* 4%3=1   5%3=2 2+int(5/3)=3 3%3=0
 | 
					 | 
				
			||||||
	6%4=2 2+6/4=3*/
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14
									
								
								Luogu/P3370 【模板】字符串哈希.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Luogu/P3370 【模板】字符串哈希.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <unordered_set>
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
						unordered_set<string> a;
 | 
				
			||||||
 | 
						int n;
 | 
				
			||||||
 | 
						cin >> n;
 | 
				
			||||||
 | 
						string x;
 | 
				
			||||||
 | 
						for(int i = 0; i < n; i++){
 | 
				
			||||||
 | 
							cin >> x;
 | 
				
			||||||
 | 
							a.emplace(x);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						cout << a.size() << endl;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user