ProgramAlgTrain/20240907/testTpl/testTpl.cpp
2024-09-17 18:55:15 +08:00

54 lines
1.1 KiB
C++

#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 zprint(const Args& ...args){
((std::cout<<args),...);
}
template<typename ...Args>
void zprintln(const Args& ...args){
std::stringstream ss;
((ss<<args<<" "),...);
ss<<"\n";
zprint(ss.str());
}
#define NAME_VALUE(v)#v,":",(v)
int main(){
zprintln("Hello,World!","-by","Zengtudor");
zprintln("End");
zprintln(NAME_VALUE(std::pow(2,10)));
zprintln(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;
}
zprintln(NAME_VALUE(v));
zprintln(NAME_VALUE(std::pow(3, 8)));
zprintln(NAME_VALUE(std::gcd(41184, 65208)));
for(int i=1;i<=1e4;i++){
zprint(i,",");
}
zprint("\n");
}