1311 条题解
-
0神-董 (董由) LV 7 @ 2022-07-16 22:18:36
/ Vijos / 题库 / A+B Problem /
题解1284 条题解
神-董 (董由) LV 7
发表您的题解
Wylker LV 8 @ 4 年前
告诉你们什么叫做暴力的题解。#include<bits/stdc++.h>
#define gou int main()
#define li {
#define guo int a,b;
#define jia cin>>a>>b;
#define sheng cout<<a+b;
#define si return 0;
#define yi }
using namespace std;
gou
li
guo
jia
sheng
si
yi
Louisssss @ 4 年前
#include<bits/stdc++.h>
#define qi int main()
#define yin
{
#define huo int a,b;
#define fu cin>>a>>b;
#define bi cout<<a+b;
#define qu return 0;
#define zhi
}
using namespace std;
qi
yin
huo
fu
bi
qu
zhineway5 @ 3 年前
学习了zrmpaul @ 2 年前
zzmg,jbl(crystal_clear @ 10 个月前
你是秀儿kunker @ 4 个月前
@Louisssss: 太秀了huyifei323 LV 4 @ 10 个月前
本题直接用 int 就能过。
完整代码:#include<iostream> //引入 iostream 头文件
using namespace std; //使用 std 命名空间
int main(){ //主函数,程序从这里开始
int a,b; //定义两个变量,一个叫 a ,一个叫 b
cin>>a>>b; //输入
cout<<a+b; //输出他们的和
return 0; //主函数应返回 0
}
讲解:
- iostream 头文件也叫输入输出流,是 C++ 特有的头文件,用来输入和输出。
- std 命名空间是 C++ 的标准命名空间,输入输出就定义在这里面。
- int main() 函数是程序的开始,一个程序必须有他。
- int a,b 是定义了两个 int 型变量,aa 和 bb。
- cin>>a>>b 是在输入 aa 和 bb。
- cout<<a+b 是在输出 a+ba+b。
- return 0 是 int main() 函数的返回值,这个返回值必须是 00 ,不然会 RE。管理员大大求通过
看在我写得这么认真的情况下,就给我点个赞吧zhangzhengyan LV 4 @ 3 周前
#include<bits/stdc++.h>
using namespace std;
signed main(){
int a,b;
cin>>a>>b;
cout<<a+b;
}
lxylluvio LV 4 @ 1 个月前
来一篇好玩的题解。#include <bits/stdc++.h>
#define _ using
#define __ namespace
#define ___ std;
#define ____ int
#define _____ main() {
#define ______ int a, b;
#define _______ cin >> a >> b;
#define ________ cout << a + b << '\n';
#define _________ }
______ _______ ________ _________
FXT1110011010OI LV 4 @ 2 个月前
基础语法//头文件
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
//命名空间
using namespace std;//主函数
int main()
{
int x, y; //定义x,y
//int类型,用"%d"输出
scanf("%d%d", &x, &y); //输入x,y
printf("%d", x + y); //输出x + y
return 0;
}
cby LV 7 @ 2 个月前
暴力解题之进阶版#include <iterator>
#include <functional>
#include<vector>
#include<deque>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<memory>
#include<utility>
#define gou int main()
#define li {
#define guo int a,b;
#define jia cin>>a>>b;
#define sheng cout<<a+b;
#define si return 0;
#define yi }
using namespace std;
gou
li
guo
jia
sheng
si
yiZYX_pi LV 6 @ 4 个月前
#include<iostream>//头文件
using namespace std;//命名空间
int main()//主函数
{
int a,b;//定义变量a b
cin>>a>>b;//输入变量a b
cout<<a+b<<endl;//输出a与b的和
return 0;//返回值
}
ZYX_pi LV 6 @ 4 个月前
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}ZYX_pi LV 6 @ 4 个月前
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}tommyfj LV 4 @ 4 个月前
最基础的A+B解法(给蒟蒻看的)#include <iostream>//头文件很重要
using namespace std;
int main()//主函数
{
int a,b,c;//定义三个变量a,b,c
cin >> a >> b;//输入a,b值
c = a+b;//求和并存入c中
cout << c;//输出c
return 0;
}点个赞再走呗,跪谢!ヾ(≧▽≦*)o
GalaxyOier LV 4 @ 9 个月前
#include<bits/stdc++.h>//万能头
using namespace std;int main()//主函数
{
int a,b;//定义
cin>>a>>b;//输入
cout<<a+b;//输出
return 0;
}
黄青玲 LV 7 @ 9 个月前
额,注意不要选错语言,不然这是入门题,零基础人不调试也能过。#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
qq913653500 LV 10 @ 4 年前
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
神-董 (董由) LV 7 @ 10 秒前
/ Vijos / 题库 / A+B Problem /
题解1283 条题解
神-董 (董由) LV 7
发表您的题解
Wylker LV 8 @ 4 年前
告诉你们什么叫做暴力的题解。#include<bits/stdc++.h>
#define gou int main()
#define li {
#define guo int a,b;
#define jia cin>>a>>b;
#define sheng cout<<a+b;
#define si return 0;
#define yi }
using namespace std;
gou
li
guo
jia
sheng
si
yi
Louisssss @ 4 年前
#include<bits/stdc++.h>
#define qi int main()
#define yin
{
#define huo int a,b;
#define fu cin>>a>>b;
#define bi cout<<a+b;
#define qu return 0;
#define zhi
}
using namespace std;
qi
yin
huo
fu
bi
qu
zhineway5 @ 3 年前
学习了zrmpaul @ 2 年前
zzmg,jbl(crystal_clear @ 10 个月前
你是秀儿kunker @ 4 个月前
@Louisssss: 太秀了huyifei323 LV 4 @ 10 个月前
本题直接用 int 就能过。
完整代码:#include<iostream> //引入 iostream 头文件
using namespace std; //使用 std 命名空间
int main(){ //主函数,程序从这里开始
int a,b; //定义两个变量,一个叫 a ,一个叫 b
cin>>a>>b; //输入
cout<<a+b; //输出他们的和
return 0; //主函数应返回 0
}
讲解:
- iostream 头文件也叫输入输出流,是 C++ 特有的头文件,用来输入和输出。
- std 命名空间是 C++ 的标准命名空间,输入输出就定义在这里面。
- int main() 函数是程序的开始,一个程序必须有他。
- int a,b 是定义了两个 int 型变量,aa 和 bb。
- cin>>a>>b 是在输入 aa 和 bb。
- cout<<a+b 是在输出 a+ba+b。
- return 0 是 int main() 函数的返回值,这个返回值必须是 00 ,不然会 RE。管理员大大求通过
看在我写得这么认真的情况下,就给我点个赞吧zhangzhengyan LV 4 @ 3 周前
#include<bits/stdc++.h>
using namespace std;
signed main(){
int a,b;
cin>>a>>b;
cout<<a+b;
}
lxylluvio LV 4 @ 1 个月前
来一篇好玩的题解。#include <bits/stdc++.h>
#define _ using
#define __ namespace
#define ___ std;
#define ____ int
#define _____ main() {
#define ______ int a, b;
#define _______ cin >> a >> b;
#define ________ cout << a + b << '\n';
#define _________ }
FXT1110011010OI LV 4 @ 2 个月前
基础语法//头文件
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
//命名空间
using namespace std;//主函数
int main()
{
int x, y; //定义x,y
//int类型,用"%d"输出
scanf("%d%d", &x, &y); //输入x,y
printf("%d", x + y); //输出x + y
return 0;
}
cby LV 7 @ 2 个月前
暴力解题之进阶版#include <iterator>
#include <functional>
#include<vector>
#include<deque>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<memory>
#include<utility>
#define gou int main()
#define li {
#define guo int a,b;
#define jia cin>>a>>b;
#define sheng cout<<a+b;
#define si return 0;
#define yi }
using namespace std;
gou
li
guo
jia
sheng
si
yiZYX_pi LV 6 @ 4 个月前
#include<iostream>//头文件
using namespace std;//命名空间
int main()//主函数
{
int a,b;//定义变量a b
cin>>a>>b;//输入变量a b
cout<<a+b<<endl;//输出a与b的和
return 0;//返回值
}
ZYX_pi LV 6 @ 4 个月前
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}ZYX_pi LV 6 @ 4 个月前
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}tommyfj LV 4 @ 4 个月前
最基础的A+B解法(给蒟蒻看的)#include <iostream>//头文件很重要
using namespace std;
int main()//主函数
{
int a,b,c;//定义三个变量a,b,c
cin >> a >> b;//输入a,b值
c = a+b;//求和并存入c中
cout << c;//输出c
return 0;
}点个赞再走呗,跪谢!ヾ(≧▽≦*)o
GalaxyOier LV 4 @ 9 个月前
#include<bits/stdc++.h>//万能头
using namespace std;int main()//主函数
{
int a,b;//定义
cin>>a>>b;//输入
cout<<a+b;//输出
return 0;
}
黄青玲 LV 7 @ 9 个月前
额,注意不要选错语言,不然这是入门题,零基础人不调试也能过。#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
qq913653500 LV 10 @ 4 年前
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
神-董 (董由) LV 7 @ 15 秒前迷雾通公司注册在爱沙尼亚,受欧盟严格的隐私法保护。我们从不会记录您的浏览信息,也绝不会向第三方主动交出任何用户资料。
更重要的是,我们即使被黑客入侵或受外力胁迫,也无法出卖我们的用户。我们使用先进的密码学算法开发了Mizaru用户认证协议。这独特的技术保证用户和浏览记录之间没有任何联系。
市场上没有任何其他翻墙软件提供迷雾通给您的私密性。
我们极其重视您的隐私。我们不会,并且根本不能监视您的浏览记录。迷雾通的代码更是全部开源的。难以封锁
迷雾通不仅仅针对已有的封锁技术。我们使用最前沿的反封锁技术,不管是现在还是未来的封锁系统都难以屏蔽迷雾通。
迷雾通更是目前市面上唯一为一切付费用户提供服务保证的翻墙软件。迷雾通被封杀几天,我们就赔款几天!实惠、简单
我们视网络自由和隐私为基本权利。所以我们提供完全免费的中速浏览,够浏览新闻、查邮件、看标清视频等。超快速度的付费Plus账号仅需€5/月。
不管您用Windows、Mac、Linux、还是Android,安装使用迷雾通并不繁琐。一键就可连接自由的互联网。永远的天狼星 LV 6 @ 2 个月前
本小弟第一次发题解
#include <iostream>
using namespace std;
int main(){
long long a,b;//注意,不开long long见祖宗
cin>>a>>b;
cout<<a+b;//很水
}November (CLH_W) LV 10 @ 3 个月前
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main(){
cin>>n>>m;
cout<<n+m;
return 0;
}zqj LV 3 @ 3 个月前
import java.util.Scanner;
public class qiuhe {public static void main(String[] args) {
int x,y,n;
Scanner sc=new Scanner(System.in);
System.out.println("请输入x的值:");
x=sc.nextInt();
System.out.println("请输入y的值:");
y=sc.nextInt();
n=x+y;
System.out.println("它们的和为:"+n);
}}
xwvrn9m1u LV 4 @ 3 个月前
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstring>
using namespace std;
struct node
{
int data,rev,sum;
node *son[2],*pre;
bool judge();
bool isroot();
void pushdown();
void update();
void setson(node *child,int lr);
}lct[233];
int top,a,b;
node *getnew(int x)
{
node *now=lct+ ++top;
now->data=x;
now->pre=now->son[1]=now->son[0]=lct;
now->sum=0;
now->rev=0;
return now;
}
bool node::judge(){return pre->son[1]==this;}
bool node::isroot()
{
if(pre==lct)return true;
return !(pre->son[1]==this||pre->son[0]==this);
}
void node::pushdown()
{
if(this==lct||!rev)return;
swap(son[0],son[1]);
son[0]->rev^=1;
son[1]->rev^=1;
rev=0;
}
void node::update(){sum=son[1]->sum+son[0]->sum+data;}
void node::setson(node *child,int lr)
{
this->pushdown();
child->pre=this;
son[lr]=child;
this->update();
}
void rotate(node *now)
{
node *father=now->pre,*grandfa=father->pre;
if(!father->isroot()) grandfa->pushdown();
father->pushdown();now->pushdown();
int lr=now->judge();
father->setson(now->son[lr^1],lr);
if(father->isroot()) now->pre=grandfa;
else grandfa->setson(now,father->judge());
now->setson(father,lr^1);
father->update();now->update();
if(grandfa!=lct) grandfa->update();
}
void splay(node *now)
{
if(now->isroot())return;
for(;!now->isroot();rotate(now))
if(!now->pre->isroot())
now->judge()==now->pre->judge()?rotate(now->pre):rotate(now);
}
node *access(node *now)
{
node *last=lct;
for(;now!=lct;last=now,now=now->pre)
{
splay(now);
now->setson(last,1);
}
return last;
}
void changeroot(node *now)
{
access(now)->rev^=1;
splay(now);
}
void connect(node *x,node *y)
{
changeroot(x);
x->pre=y;
access(x);
}
void cut(node *x,node *y)
{
changeroot(x);
access(y);
splay(x);
x->pushdown();
x->son[1]=y->pre=lct;
x->update();
}
int query(node *x,node *y)
{
changeroot(x);
node *now=access(y);
return now->sum;
}
int main()
{
scanf("%d%d",&a,&b);
node *A=getnew(a);
node *B=getnew(b);
//连边 Link
connect(A,B);
//断边 Cut
cut(A,B);
//再连边orz Link again
connect(A,B);
printf("%d\n",query(A,B));
return 0;
}xwvrn9m1u LV 4 @ 3 个月前
计算就完了谁不会谁可以不用学了kunker LV 4 @ 4 个月前
#include <bits/stdc++.h>
using namespace std;int main()
{
long long a, b;scanf("%d %d", &a, &b);
printf("%d", a + b);
return 0;
}1 2 3 4 5
A+B Problem
查看题目
递交
讨论
题解
信息
ID
1000
递交
Accepted
通过消息
flag{1+1=2}
难度
9
分类
(无)
标签
(无)
递交数
71475
我的递交数
1
已通过
27517
通过率
38%
被复制
141
状态
开发
支持
关于 联系我们 隐私 服务条款 版权申诉 Language
© 2005 - 2021 Vijos.org uibuild-f24a75e-10-gf0efbad-dirty 沪ICP备14040537号-1神-董 (董由) LV 7 @ 32 秒前
迷雾通公司注册在爱沙尼亚,受欧盟严格的隐私法保护。我们从不会记录您的浏览信息,也绝不会向第三方主动交出任何用户资料。
更重要的是,我们即使被黑客入侵或受外力胁迫,也无法出卖我们的用户。我们使用先进的密码学算法开发了Mizaru用户认证协议。这独特的技术保证用户和浏览记录之间没有任何联系。
市场上没有任何其他翻墙软件提供迷雾通给您的私密性。
我们极其重视您的隐私。我们不会,并且根本不能监视您的浏览记录。迷雾通的代码更是全部开源的。难以封锁
迷雾通不仅仅针对已有的封锁技术。我们使用最前沿的反封锁技术,不管是现在还是未来的封锁系统都难以屏蔽迷雾通。
迷雾通更是目前市面上唯一为一切付费用户提供服务保证的翻墙软件。迷雾通被封杀几天,我们就赔款几天!实惠、简单
我们视网络自由和隐私为基本权利。所以我们提供完全免费的中速浏览,够浏览新闻、查邮件、看标清视频等。超快速度的付费Plus账号仅需€5/月。
不管您用Windows、Mac、Linux、还是Android,安装使用迷雾通并不繁琐。一键就可连接自由的互联网。永远的天狼星 LV 6 @ 2 个月前
本小弟第一次发题解
#include <iostream>
using namespace std;
int main(){
long long a,b;//注意,不开long long见祖宗
cin>>a>>b;
cout<<a+b;//很水
}November (CLH_W) LV 10 @ 3 个月前
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main(){
cin>>n>>m;
cout<<n+m;
return 0;
}zqj LV 3 @ 3 个月前
import java.util.Scanner;
public class qiuhe {public static void main(String[] args) {
int x,y,n;
Scanner sc=new Scanner(System.in);
System.out.println("请输入x的值:");
x=sc.nextInt();
System.out.println("请输入y的值:");
y=sc.nextInt();
n=x+y;
System.out.println("它们的和为:"+n);
}}
xwvrn9m1u LV 4 @ 3 个月前
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstring>
using namespace std;
struct node
{
int data,rev,sum;
node *son[2],*pre;
bool judge();
bool isroot();
void pushdown();
void update();
void setson(node *child,int lr);
}lct[233];
int top,a,b;
node *getnew(int x)
{
node *now=lct+ ++top;
now->data=x;
now->pre=now->son[1]=now->son[0]=lct;
now->sum=0;
now->rev=0;
return now;
}
bool node::judge(){return pre->son[1]==this;}
bool node::isroot()
{
if(pre==lct)return true;
return !(pre->son[1]==this||pre->son[0]==this);
}
void node::pushdown()
{
if(this==lct||!rev)return;
swap(son[0],son[1]);
son[0]->rev^=1;
son[1]->rev^=1;
rev=0;
}
void node::update(){sum=son[1]->sum+son[0]->sum+data;}
void node::setson(node *child,int lr)
{
this->pushdown();
child->pre=this;
son[lr]=child;
this->update();
}
void rotate(node *now)
{
node *father=now->pre,*grandfa=father->pre;
if(!father->isroot()) grandfa->pushdown();
father->pushdown();now->pushdown();
int lr=now->judge();
father->setson(now->son[lr^1],lr);
if(father->isroot()) now->pre=grandfa;
else grandfa->setson(now,father->judge());
now->setson(father,lr^1);
father->update();now->update();
if(grandfa!=lct) grandfa->update();
}
void splay(node *now)
{
if(now->isroot())return;
for(;!now->isroot();rotate(now))
if(!now->pre->isroot())
now->judge()==now->pre->judge()?rotate(now->pre):rotate(now);
}
node *access(node *now)
{
node *last=lct;
for(;now!=lct;last=now,now=now->pre)
{
splay(now);
now->setson(last,1);
}
return last;
}
void changeroot(node *now)
{
access(now)->rev^=1;
splay(now);
}
void connect(node *x,node *y)
{
changeroot(x);
x->pre=y;
access(x);
}
void cut(node *x,node *y)
{
changeroot(x);
access(y);
splay(x);
x->pushdown();
x->son[1]=y->pre=lct;
x->update();
}
int query(node *x,node *y)
{
changeroot(x);
node *now=access(y);
return now->sum;
}
int main()
{
scanf("%d%d",&a,&b);
node *A=getnew(a);
node *B=getnew(b);
//连边 Link
connect(A,B);
//断边 Cut
cut(A,B);
//再连边orz Link again
connect(A,B);
printf("%d\n",query(A,B));
return 0;
}xwvrn9m1u LV 4 @ 3 个月前
计算就完了谁不会谁可以不用学了1 2 3 4 5
A+B Problem
查看题目
递交
讨论
题解
信息
ID
1000
递交
Accepted
通过消息
flag{1+1=2}
难度
9
分类
(无)
标签
(无)
递交数
71475
我的递交数
1
已通过
27517
通过率
38%
被复制
141
状态
开发
支持
关于 联系我们 隐私 服务条款 版权申诉 Language
© 2005 - 2021 Vijos.org uibuild-f24a75e-10-gf0efbad-dirty 沪ICP备14040537号-1 -
02022-07-16 22:17:47@
迷雾通公司注册在爱沙尼亚,受欧盟严格的隐私法保护。我们从不会记录您的浏览信息,也绝不会向第三方主动交出任何用户资料。
更重要的是,我们即使被黑客入侵或受外力胁迫,也无法出卖我们的用户。我们使用先进的密码学算法开发了Mizaru用户认证协议。这独特的技术保证用户和浏览记录之间没有任何联系。
市场上没有任何其他翻墙软件提供迷雾通给您的私密性。
我们极其重视您的隐私。我们不会,并且根本不能监视您的浏览记录。迷雾通的代码更是全部开源的。难以封锁
迷雾通不仅仅针对已有的封锁技术。我们使用最前沿的反封锁技术,不管是现在还是未来的封锁系统都难以屏蔽迷雾通。
迷雾通更是目前市面上唯一为一切付费用户提供服务保证的翻墙软件。迷雾通被封杀几天,我们就赔款几天!实惠、简单
我们视网络自由和隐私为基本权利。所以我们提供完全免费的中速浏览,够浏览新闻、查邮件、看标清视频等。超快速度的付费Plus账号仅需€5/月。
不管您用Windows、Mac、Linux、还是Android,安装使用迷雾通并不繁琐。一键就可连接自由的互联网。 -
02022-06-24 22:11:47@
#include<bits/stdc++.h> using namespace std; signed main(){ int a,b; cin>>a>>b; cout<<a+b; }
-
02022-06-14 10:07:01@
来一篇好玩的题解。
#include <bits/stdc++.h> #define _ using #define __ namespace #define ___ std; #define ____ int #define _____ main() { #define ______ int a, b; #define _______ cin >> a >> b; #define ________ cout << a + b << '\n'; #define _________ } _ __ ___ ____ _____ ______ _______ ________ _________
-
02022-05-08 18:14:23@
基础语法
//头文件 #include <iostream> #include <cstring> #include <algorithm> #include <cstdio> #include <cmath> //命名空间 using namespace std; //主函数 int main() { int x, y; //定义x,y //int类型,用"%d"输出 scanf("%d%d", &x, &y); //输入x,y printf("%d", x + y); //输出x + y return 0; }
-
02022-05-06 19:54:07@
本小弟第一次发题解
#include <iostream>
using namespace std;
int main(){
long long a,b;//注意,不开long long见祖宗
cin>>a>>b;
cout<<a+b;//很水
} -
02022-04-29 20:59:18@
暴力解题之进阶版
#include <iterator>
#include <functional>
#include<vector>
#include<deque>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<memory>
#include<utility>
#define gou int main()
#define li {
#define guo int a,b;
#define jia cin>>a>>b;
#define sheng cout<<a+b;
#define si return 0;
#define yi }
using namespace std;
gou
li
guo
jia
sheng
si
yi
-
02022-04-09 15:30:33@
#include<bits/stdc++.h> using namespace std; int n,m; int main(){ cin>>n>>m; cout<<n+m; return 0; }
-
02022-03-19 11:17:11@
import java.util.Scanner;
public class qiuhe {public static void main(String[] args) {
int x,y,n;
Scanner sc=new Scanner(System.in);
System.out.println("请输入x的值:");
x=sc.nextInt();
System.out.println("请输入y的值:");
y=sc.nextInt();
n=x+y;
System.out.println("它们的和为:"+n);
}}
-
02022-03-18 11:18:59@
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstring>
using namespace std;
struct node
{
int data,rev,sum;
node *son[2],*pre;
bool judge();
bool isroot();
void pushdown();
void update();
void setson(node *child,int lr);
}lct[233];
int top,a,b;
node *getnew(int x)
{
node *now=lct+ ++top;
now->data=x;
now->pre=now->son[1]=now->son[0]=lct;
now->sum=0;
now->rev=0;
return now;
}
bool node::judge(){return pre->son[1]==this;}
bool node::isroot()
{
if(pre==lct)return true;
return !(pre->son[1]==this||pre->son[0]==this);
}
void node::pushdown()
{
if(this==lct||!rev)return;
swap(son[0],son[1]);
son[0]->rev^=1;
son[1]->rev^=1;
rev=0;
}
void node::update(){sum=son[1]->sum+son[0]->sum+data;}
void node::setson(node *child,int lr)
{
this->pushdown();
child->pre=this;
son[lr]=child;
this->update();
}
void rotate(node *now)
{
node *father=now->pre,*grandfa=father->pre;
if(!father->isroot()) grandfa->pushdown();
father->pushdown();now->pushdown();
int lr=now->judge();
father->setson(now->son[lr^1],lr);
if(father->isroot()) now->pre=grandfa;
else grandfa->setson(now,father->judge());
now->setson(father,lr^1);
father->update();now->update();
if(grandfa!=lct) grandfa->update();
}
void splay(node *now)
{
if(now->isroot())return;
for(;!now->isroot();rotate(now))
if(!now->pre->isroot())
now->judge()==now->pre->judge()?rotate(now->pre):rotate(now);
}
node *access(node *now)
{
node *last=lct;
for(;now!=lct;last=now,now=now->pre)
{
splay(now);
now->setson(last,1);
}
return last;
}
void changeroot(node *now)
{
access(now)->rev^=1;
splay(now);
}
void connect(node *x,node *y)
{
changeroot(x);
x->pre=y;
access(x);
}
void cut(node *x,node *y)
{
changeroot(x);
access(y);
splay(x);
x->pushdown();
x->son[1]=y->pre=lct;
x->update();
}
int query(node *x,node *y)
{
changeroot(x);
node *now=access(y);
return now->sum;
}
int main()
{
scanf("%d%d",&a,&b);
node *A=getnew(a);
node *B=getnew(b);
//连边 Link
connect(A,B);
//断边 Cut
cut(A,B);
//再连边orz Link again
connect(A,B);
printf("%d\n",query(A,B));
return 0;
} -
02022-03-18 11:18:08@
计算就完了谁不会谁可以不用学了
-
02022-03-12 16:43:12@
#include<iostream>//头文件 using namespace std;//命名空间 int main()//主函数 { int a,b;//定义变量a b cin>>a>>b;//输入变量a b cout<<a+b<<endl;//输出a与b的和 return 0;//返回值 }
-
02022-03-12 16:40:27@
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
} -
02022-03-12 16:40:22@
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
} -
02022-02-27 13:49:38@
最基础的A+B解法(给蒟蒻看的)
#include <iostream>//头文件很重要 using namespace std; int main()//主函数 { int a,b,c;//定义三个变量a,b,c cin >> a >> b;//输入a,b值 c = a+b;//求和并存入c中 cout << c;//输出c return 0; }
点个赞再走呗,跪谢!ヾ(≧▽≦*)o
-
02022-02-27 13:40:53@
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; scanf("%d %d", &a, &b); printf("%d", a + b); return 0; }
-
02022-02-19 10:25:16@
#include <iostream> #include <string> using namespace std; string BigNumAdd(string,int,string ,int); //函数声明 int main() { string a,b; //用字符串来保存数据 C语言的朋友可以用char * cin>>a>>b; if(a.size()<b.size()) //作用:把长串放在a中 短串放在b中 最终结果是存在a中 { string temp=a; a=b; b=temp; } cout<<BigNumAdd(a,a.size(),b,b.size())<<endl; //函数调用 return 0; } string BigNumAdd(string a,int lena,string b,int lenb) { int aa,bb,sum,flag=0; //flag进位标志,默认为0 while(lena>0) { aa=a[lena-1]-'0'; //将a字符串的最后一个字符变成数字 if(lenb>0) bb=b[lenb-1]-'0'; //将b字符串的最后一个字符变成数字 else bb=0; sum=aa+bb+flag; //sum用来保存a和b最后一个数字相加并加上进位 if(sum>=10) //相加大于10 当然要进位 { a[lena-1]='0'+sum%10; flag=1; //进位标志设为1 } else { a[lena-1]='0'+sum; flag=0; } lena--; lenb--; } if(flag==1) //如果最高位的前面还有进位 a="1"+a; //则字符串追加 把1追加到a字符串的前面 return a; //返回a作为 相加的结果 }
-
02021-10-04 14:59:21@
#include<bits/stdc++.h>//万能头 using namespace std; int main()//主函数 { int a,b;//定义 cin>>a>>b;//输入 cout<<a+b;//输出 return 0; }
-
02021-09-27 17:12:11@
额,注意不要选错语言,不然这是入门题,零基础人不调试也能过。
#include <iostream> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }
-
02018-08-16 21:00:58@
<div>
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>我好菜啊</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style>
#scene{
position: relative;
width: 400px;
height: 400px;
background-color: #000;
color:#fff;
text-align: center;
font-weight: 700;
font-size: 72px;
}
#scene div.layer{
width:400px;
height: 100px;
position: absolute;
margin:auto;
left:0;
right:0;
top:0;
bottom:0;
}
.blueFlash{
color: rgb(1, 205, 232);
-webkit-animation: blueFlash .9s infinite both;
}.pinkFlash{
color: rgb(255, 37, 233);
-webkit-animation: pinkFlash .9s infinite both;
}@-webkit-keyframes pinkFlash{
0%{
opacity:0;
transform: matrix(1, 0, 0, 1, 0, 0);
}
62.5%{
opacity:0;
transform: matrix(1, 0, 0, 1, 2, 2);
}
75%{
opacity:0;
transform: matrix(1, 0, 0, 1, 3, 3);
}
87.5%{
opacity:1;
transform: matrix(1, 0, 0, 1, 4, 4);
}
100%{
opacity:0;
transform: matrix(1, 0, 0, 1, 0, 0);
}}
@-webkit-keyframes blueFlash{
0%{
opacity:0;
transform: matrix(1, 0, 0, 1, 0, 0);
}
12.5%{
opacity:0;
transform: matrix(1, 0, 0, 1, 2, 2);
}
25%{
opacity:0;
transform: matrix(1, 0, 0, 1, 3, 3);
}
37.5%{
opacity:1;
transform: matrix(1, 0, 0, 1, 4, 4);
}
50%{
opacity:0;
transform: matrix(1, 0, 0, 1, -1, -1);
}
62.5%{
opacity:0;
transform: matrix(1, 0, 0, 1, -2, -2);
}
75%{
opacity:0;
transform: matrix(1, 0, 0, 1, -3, -3);
}
87.5%{
opacity:1;
transform: matrix(1, 0, 0, 1, -4, -4);
}
100%{
opacity:0;
transform: matrix(1, 0, 0, 1, 0, 0);
}
}</style>
</head>
<body>
<div id="scene">
<div class="layer">
<div class="text_holder pinkFlash">我好菜啊</div>
</div>
<div class="layer">
<div class="text_holder blueFlash">我好菜啊</div>
</div>
<div class="layer">
<div class="text_holder">我好菜啊</div>
</div>
</div>
</body>
</div>
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 73527
- 已通过
- 28207
- 通过率
- 38%
- 被复制
- 201