update
This commit is contained in:
		
							parent
							
								
									c69cdd105f
								
							
						
					
					
						commit
						194e80fe0d
					
				
							
								
								
									
										54
									
								
								20240907/testTpl/testTpl.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								20240907/testTpl/testTpl.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					#include <cmath>
 | 
				
			||||||
 | 
					#include <cstdio>
 | 
				
			||||||
 | 
					#include<iostream>
 | 
				
			||||||
 | 
					#include <numeric>
 | 
				
			||||||
 | 
					#include <sstream>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef unsigned int u8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::ostream& operator<<(std::ostream &os,const std::vector<int> &v){
 | 
				
			||||||
 | 
					    os<<"vector { ";
 | 
				
			||||||
 | 
					    for(int i=0;(u8)i<v.size()-1;i++){
 | 
				
			||||||
 | 
					        os<<v[i]<<" ,";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    os<<v[v.size()-1]<<" }";
 | 
				
			||||||
 | 
					    return os;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename ...Args>
 | 
				
			||||||
 | 
					void print(const Args& ...args){
 | 
				
			||||||
 | 
					    ((std::cout<<args),...);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename ...Args>
 | 
				
			||||||
 | 
					void println(const Args& ...args){
 | 
				
			||||||
 | 
					    std::stringstream ss;
 | 
				
			||||||
 | 
					    ((ss<<args<<" "),...);
 | 
				
			||||||
 | 
					    ss<<"\n";
 | 
				
			||||||
 | 
					    print(ss.str());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME_VALUE(v)#v,":",(v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(){
 | 
				
			||||||
 | 
					    println("Hello,World!","-by","Zengtudor");
 | 
				
			||||||
 | 
					    println("End");
 | 
				
			||||||
 | 
					    println(NAME_VALUE(std::pow(2,10)));
 | 
				
			||||||
 | 
					    println(NAME_VALUE((int)0x7FFFFFFF));
 | 
				
			||||||
 | 
					    std::vector<int> v(10);
 | 
				
			||||||
 | 
					    v[0]=1;
 | 
				
			||||||
 | 
					    for(int i=1;(u8)i<v.size();i++){
 | 
				
			||||||
 | 
					        v[i]=(v[i-1]*3+2)%49;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    println(NAME_VALUE(v));
 | 
				
			||||||
 | 
					    println(NAME_VALUE(std::pow(3, 8)));
 | 
				
			||||||
 | 
					    println(NAME_VALUE(std::gcd(41184, 65208)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for(int i=1;i<=1e4;i++){
 | 
				
			||||||
 | 
					        print(i,",");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    print("\n");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										46
									
								
								20240908/P2016/P2016.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								20240908/P2016/P2016.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,46 @@
 | 
				
			|||||||
 | 
					#include <algorithm>
 | 
				
			||||||
 | 
					#include <climits>
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const int MAX_N = 1.5e5+5;
 | 
				
			||||||
 | 
					int n;
 | 
				
			||||||
 | 
					std::vector<int> v[MAX_N];
 | 
				
			||||||
 | 
					int dp[MAX_N][2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void dfs(const int n,const int f){
 | 
				
			||||||
 | 
					    for(auto &i:v[n]){
 | 
				
			||||||
 | 
					        if(i!=f)dfs(i, n);
 | 
				
			||||||
 | 
					        else continue;
 | 
				
			||||||
 | 
					        dp[n][1]+=std::min(dp[i][0],dp[i][1]);
 | 
				
			||||||
 | 
					        dp[n][0]+=dp[i][1];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(){
 | 
				
			||||||
 | 
					    std::cin>>n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for(int _i=0;_i<n;_i++){
 | 
				
			||||||
 | 
					        dp[_i][1]=1;
 | 
				
			||||||
 | 
					        int i,k;
 | 
				
			||||||
 | 
					        std::cin>>i>>k;
 | 
				
			||||||
 | 
					        for(int j=1;j<=k;j++){
 | 
				
			||||||
 | 
					            int r;
 | 
				
			||||||
 | 
					            std::cin>>r;
 | 
				
			||||||
 | 
					            v[i].push_back(r);
 | 
				
			||||||
 | 
					            v[r].push_back(i);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dfs(0,-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::cout<<std::min(dp[0][1],dp[0][0]);
 | 
				
			||||||
 | 
					}   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					4
 | 
				
			||||||
 | 
					0 1 1
 | 
				
			||||||
 | 
					1 2 2 3
 | 
				
			||||||
 | 
					2 0
 | 
				
			||||||
 | 
					3 0
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
							
								
								
									
										43
									
								
								20240915/1808/1808.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								20240915/1808/1808.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					//http://noi.openjudge.cn/ch0206/1808
 | 
				
			||||||
 | 
					#include <algorithm>
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <sstream>
 | 
				
			||||||
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const int MAX_LEN = 200+5;
 | 
				
			||||||
 | 
					std::string s1,s2;
 | 
				
			||||||
 | 
					int dp[MAX_LEN][MAX_LEN];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename T>
 | 
				
			||||||
 | 
					T max(const T t1,const T t2,const T t3){
 | 
				
			||||||
 | 
					    return std::max(t1,std::max(t2,t3));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename ...Args>
 | 
				
			||||||
 | 
					void print(const Args&...args){
 | 
				
			||||||
 | 
					    std::stringstream ss;
 | 
				
			||||||
 | 
					    ((ss<<args),...);
 | 
				
			||||||
 | 
					    std::cout<<ss.str();
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(){
 | 
				
			||||||
 | 
					    while (std::cin>>s1>>s2) {
 | 
				
			||||||
 | 
					        for(int i=1;i<=s1.length();i++){
 | 
				
			||||||
 | 
					            for(int j=1;j<=s2.length();j++){
 | 
				
			||||||
 | 
					                if(s1[i-1]==s2[j-1]){
 | 
				
			||||||
 | 
					                    dp[i][j] = dp[i-1][j-1] + 1;
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    dp[i][j] = max(dp[i][j-1], dp[i-1][j], dp[i-1][j-1]);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        // std::cout<<dp[s1.length()][s2.length()]<<"\n";
 | 
				
			||||||
 | 
					        print(dp[s1.length()][s2.length()],"\n");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					abcfbc         abfcab
 | 
				
			||||||
 | 
					programming    contest 
 | 
				
			||||||
 | 
					abcd           mnp
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
							
								
								
									
										83
									
								
								test.cpp
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								test.cpp
									
									
									
									
									
								
							@ -1,38 +1,59 @@
 | 
				
			|||||||
#include <cmath>
 | 
					// #include <cmath>
 | 
				
			||||||
 | 
					// #include<iostream>
 | 
				
			||||||
 | 
					// #include <numeric>
 | 
				
			||||||
 | 
					// #include <sstream>
 | 
				
			||||||
 | 
					// #include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// typedef unsigned int u8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// std::ostream& operator<<(std::ostream &os,const std::vector<int> &v){
 | 
				
			||||||
 | 
					//     os<<"vector { ";
 | 
				
			||||||
 | 
					//     for(int i=0;(u8)i<v.size()-1;i++){
 | 
				
			||||||
 | 
					//         os<<v[i]<<" ,";
 | 
				
			||||||
 | 
					//     }
 | 
				
			||||||
 | 
					//     os<<v[v.size()-1]<<" }";
 | 
				
			||||||
 | 
					//     return os;
 | 
				
			||||||
 | 
					// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// template<typename ...Args>
 | 
				
			||||||
 | 
					// void print(const Args& ...args){
 | 
				
			||||||
 | 
					//     ((std::cout<<args),...);
 | 
				
			||||||
 | 
					// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// template<typename ...Args>
 | 
				
			||||||
 | 
					// void println(const Args& ...args){
 | 
				
			||||||
 | 
					//     std::stringstream ss;
 | 
				
			||||||
 | 
					//     ((ss<<args<<" "),...);
 | 
				
			||||||
 | 
					//     ss<<"\n";
 | 
				
			||||||
 | 
					//     print(ss.str());
 | 
				
			||||||
 | 
					// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #define NAME_VALUE(v)#v,":",(v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// int main(){
 | 
				
			||||||
 | 
					//     println("Hello,World!","-by","Zengtudor");
 | 
				
			||||||
 | 
					//     println("End");
 | 
				
			||||||
 | 
					//     println(NAME_VALUE(std::pow(2,10)));
 | 
				
			||||||
 | 
					//     println(NAME_VALUE((int)0x7FFFFFFF));
 | 
				
			||||||
 | 
					//     std::vector<int> v(10);
 | 
				
			||||||
 | 
					//     v[0]=1;
 | 
				
			||||||
 | 
					//     for(int i=1;(u8)i<v.size();i++){
 | 
				
			||||||
 | 
					//         v[i]=(v[i-1]*3+2)%49;
 | 
				
			||||||
 | 
					//     }
 | 
				
			||||||
 | 
					//     println(v);
 | 
				
			||||||
 | 
					//     println(NAME_VALUE(std::pow(3, 8)));
 | 
				
			||||||
 | 
					//     println(NAME_VALUE(std::gcd(41184, 65208)));
 | 
				
			||||||
 | 
					// }
 | 
				
			||||||
#include<iostream>
 | 
					#include<iostream>
 | 
				
			||||||
#include <vector>
 | 
					#include<string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::ostream& operator<<(std::ostream &os,const std::vector<int> &v){
 | 
					void print(){
 | 
				
			||||||
    os<<"vector { ";
 | 
					 | 
				
			||||||
    for(int i=0;i<v.size()-1;i++){
 | 
					 | 
				
			||||||
        os<<v[i]<<" ,";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    os<<v[v.size()-1]<<" }";
 | 
					 | 
				
			||||||
    return os;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename ...Args>
 | 
					 | 
				
			||||||
void print(const Args& ...args){
 | 
					 | 
				
			||||||
    ((std::cout<<args),...);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename ...Args>
 | 
					 | 
				
			||||||
void println(const Args& ...args){
 | 
					 | 
				
			||||||
    (print(args," "),...);
 | 
					 | 
				
			||||||
    print("\n");
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define NAME_VALUE(v)#v,":",(v)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int main(){
 | 
					int main(){
 | 
				
			||||||
    println("Hello,World!","-by","Zengtudor");
 | 
					    std::string s;
 | 
				
			||||||
    println("End");
 | 
					    std::cin>>s;
 | 
				
			||||||
    println(NAME_VALUE(std::pow(2,10)));
 | 
					 | 
				
			||||||
    println(NAME_VALUE((int)0x7FFFFFFF));
 | 
					 | 
				
			||||||
    std::vector<int> v(10);
 | 
					 | 
				
			||||||
    v[0]=1;
 | 
					 | 
				
			||||||
    for(int i=1;i<v.size();i++){
 | 
					 | 
				
			||||||
        v[i]=(v[i-1]*3+2)%49;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    println(v);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -49,3 +49,12 @@ target("bitset")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
target("P1352")
 | 
					target("P1352")
 | 
				
			||||||
    add_files("20240907/P1352/P1352.cpp")
 | 
					    add_files("20240907/P1352/P1352.cpp")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target("testTpl")
 | 
				
			||||||
 | 
					    add_files("20240907/testTpl/testTpl.cpp")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target("P2016")
 | 
				
			||||||
 | 
					    add_files("20240908/P2016/P2016.cpp")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target("oj1808")
 | 
				
			||||||
 | 
					    add_files("20240915/1808/1808.cpp")
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user