1285 条题解
-
13
Wylker LV 8 @ 2018-05-01 16:13:03
告诉你们什么叫做暴力的题解。
#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
-
42021-08-30 11:48:08@
本题直接用
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
型变量,\(a\) 和 \(b\)。
-cin>>a>>b
是在输入 \(a\) 和 \(b\)。
-cout<<a+b
是在输出 \(a+b\)。
-return 0
是int main()
函数的返回值,这个返回值必须是 \(0\) ,不然会 RE。管理员大大求通过
看在我写得这么认真的情况下,就给我点个赞吧 -
12022-06-24 22:11:47@
#include<bits/stdc++.h> using namespace std; signed main(){ int a,b; cin>>a>>b; cout<<a+b; }
-
12022-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 _________ } _ __ ___ ____ _____ ______ _______ ________ _________
-
12022-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; }
-
12022-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
-
12022-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;//返回值 }
-
12022-03-12 16:40:27@
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
} -
12022-03-12 16:40:22@
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
} -
12022-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
-
12021-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; }
-
12021-09-27 17:12:11@
额,注意不要选错语言,不然这是入门题,零基础人不调试也能过。
#include <iostream> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }
-
12017-08-05 11:40:48@
#include <iostream> using namespace std; int main() { int a,b; cin>>a>>b; cout<<a+b; 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-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-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
- 分类
- (无)
- 标签
- (无)
- 递交数
- 71387
- 已通过
- 27471
- 通过率
- 38%
- 被复制
- 140