1323 条题解
-
0qh0816 LV 7 @ 2024-08-13 16:28:00
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
if(0<=x,y<=32767){
cout<<x+y;
}else{
cout<<"NO";
}
return 0;
}
此题非常的简单
直接一个if()就可以过 -
02024-07-09 13:56:08@
特别简单
#include<bits/stdc++.h>//万能头文件 using namespace std;//使用一个标准的命名空间 int main(){ int a,b;//定义变量a,b cin>>a>>b;//手动输入a和b cout<<a+b<<endl;//输出a+b的值 return 0;//返回0 ,程序结束 }
点个赞再走呗🥺
-
02024-06-01 16:05:45@
#include<bits/stdc++.h> int a,b; int main(){ scanf("%d%d",&a,&b); printf("%d",a+b); return 0; }
-
02024-05-26 11:34:40@
很简单
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
} -
02023-09-15 18:00:59@
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c;
cin>>a>>b;
c=a+b;
printf ("%d",c);
} -
02023-08-28 16:43:23@
#incude<iostream> using namespace std; int main(){ int a, b; cin >> a >> b; cout << a + b; return 0; }
-
02023-08-23 14:29:32@
#include<bits/stdc++.h> using namespace std; int main(){ long long a,b; cin>>a>>b; cout<<a+b; return 0; }
-
02023-08-20 16:04:30@
#include <iostream> using namespace std; int main(){ int x,y; cin>>x>>y; cout<<x+y; return 0; }
-
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-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-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-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作为 相加的结果 }
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 74446
- 已通过
- 28492
- 通过率
- 38%
- 被复制
- 223