代码高亮对比测试(附带CSS)

C++竞赛编程模板
本文提供了三种C++竞赛编程模板,包括推荐的第一种模板,详细展示了标准输入输出同步关闭、读取变量、添加边和深度优先搜索等操作,适用于解决图论问题。
第一种(推荐的)
#include<bits/stdc++.h> typedef long long ll; #define inf 0x7fffffff #define mem(a,b) memset( a,b,sizeof a) #define Max(a,b) a>b ? a=a : a=b #define Min(a,b) a<b ? a=a : a=b const int maxn=1e6+7; using namespace std;36 int main() { std::ios::sync_with_stdio(false); cin>>n; for(int i=0,a,b;i<n-1;i++){ cin>>a>>b; add(a,b); add(b,a); } dfs(1,0,0); dfs(s,0,0); cout<<ans+1<<endl; return 0; }
第二种

#include<bits/stdc++.h> typedef long long ll; #define inf 0x7fffffff #define mem(a,b) memset( a,b,sizeof a) #define Max(a,b) a>b ? a=a : a=b #define Min(a,b) a<b ? a=a : a=b const int maxn=1e6+7; using namespace std;36 int main() { std::ios::sync_with_stdio(false); cin>>n; for(int i=0,a,b;i<n-1;i++){ cin>>a>>b; add(a,b); add(b,a); } dfs(1,0,0); dfs(s,0,0); cout<<ans+1<<endl; return 0; }

  

第三种,换一种着色方案的
#include<bits/stdc++.h> typedef long long ll; #define inf 0x7fffffff #define mem(a,b) memset( a,b,sizeof a) #define Max(a,b) a>b ? a=a : a=b #define Min(a,b) a<b ? a=a : a=b const int maxn=1e6+7; using namespace std;36 int main() { std::ios::sync_with_stdio(false); cin>>n; for(int i=0,a,b;i<n-1;i++){ cin>>a>>b; add(a,b); add(b,a); } dfs(1,0,0); dfs(s,0,0); cout<<ans+1<<endl; return 0; }

 综上感觉都差不多的,以后就用第一种好了;

下面是CSS贴到后台就行了

 

/*代码高亮*/
.syntaxhighlighter .bold {
    font-weight:unset !important;
}
.syntaxhighlighter .line {
    background-color: rgb(40, 43, 46)!important;
}
.syntaxhighlighter .line.alt2 {
    background-color: rgb(40, 43, 46)!important;
}
.syntaxhighlighter .line.alt1 {
    background-color: rgb(40, 43, 46)!important;
}
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
    color: rgb(129, 142, 150)!important;
}
.syntaxhighlighter .keyword {
    color: rgb(147, 199, 99)!important;
    font-weight: unset !important;
}
.syntaxhighlighter .preprocessor {
    color: rgb(85, 113, 130) !important;
}
.syntaxhighlighter .plain, .syntaxhighlighter .plain a {
    color: rgb(224, 226, 228)!important;
}
.syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
    color: rgb(147, 199, 99)!important;
}
.syntaxhighlighter .string, .syntaxhighlighter .string a {
    color: rgb(236, 118, 0)!important;
}
.syntaxhighlighter .functions {
    color: rgb(140, 187, 173)!important;
}
.syntaxhighlighter .gutter .line {
    border-right: 2px solid rgb(147, 199, 99)!important;
}
.syntaxhighlighter.collapsed .toolbar {
    background: rgb(40, 43, 46)!important;
    border: none !important;
    border-radius: 5px !important;
}
.syntaxhighlighter.collapsed .toolbar a {
    color: rgb(147, 199, 99)!important;
}
.syntaxhighlighter.collapsed .toolbar a:hover {
    color: rgb(78, 109, 48)!important;
}
.syntaxhighlighter {
    border-radius: 5px;
}
/*第一种高亮结束,第二种高亮开始*/
.cnblogs_code div {
    background: #282b2e;
}
.cnblogs_code {
    background: #282b2e;
    border-radius: 5px;
    border: none;
    font-family: consolas !important;
    color: #fff;
}
.cnblogs_code_toolbar {
    background: #282b2e !important;
}
.cnblogs_code_toolbar a:hover, .cnblogs_code_toolbar a:link, .cnblogs_code_toolbar a:visited, .cnblogs_code_toolbar a:active, .cnblogs_code_toolbar a:link img, .cnblogs_code_toolbar a:visited img {
    background-color: #282b2e !important;
    border: none!important;
}
.cnblogs_code pre {
    font-family: consolas !important;
    padding-left: 3px;
    color: rgb(224, 226, 228);
}
.cnblogs_code span[style="color: #000000;"] , .cnblogs_code span[style="color: #ff0000;"]{
    color: rgb(224, 226, 228) !important;
}
.cnblogs_code span[style="color: #0000ff;"]{
    color: rgb(147, 199, 99)!important;
}
.cnblogs_code span[style="color: #800080;"]{
    color: #ffd740 !important;
}
.cnblogs_code span[style="color: #800000;"]{
    color: rgb(236, 118, 0)!important;
}
.cnblogs_code span[style="color: #008000;"]{
    color: rgb(129, 142, 150)!important;
}
.cnblogs_code span[style="color: #008080;"]{
    color: #afafaf!important;
    margin-right: 5px;
}
.cnblogs_code_collapse {
    border: none;
    background: #282b2e;
    color: rgb(147, 199, 99);
}
.cnblogs_code > pre {
    border: none !important;
}
.cnblogs_code > textarea {
    color: #fff;
    background: transparent;
    border: none;
    outline: none;
}
/*代码高亮结束*/
View Code

 

转载于:https://www.cnblogs.com/37kiazz73/p/10540908.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值