ProgramAlgTrain/20240907/testTpl/testTpl.cpp
2024-09-15 17:35:54 +08:00

55 lines
1.1 KiB
C++

#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");
}