1328 条题解
-
-1
Tao LV 4 @ 2019-11-21 12:29:00
216
4165 -
-12019-11-20 13:03:52@
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
} -
-12019-11-17 10:09:24@
作死ing
#include<bits/stdc++.h> using namespace std; char s[10001],ss[10001]; int a[10001],b[10001],c[10001],j; bool x=false; int main() { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(c,0,sizeof(c)); scanf("%s%s",s,ss); a[0]=strlen(s); b[0]=strlen(ss); for(int i=1; i<=a[0]; i++) a[i]=s[a[0]-i]-'0'; for(int i=1; i<=b[0]; i++) b[i]=ss[b[0]-i]-'0'; for(j=1; j<=max(a[0],b[0])+1; j++) { c[j]=a[j]+b[j]; if(c[j]>=10) { c[j]%=10; a[j+1]++; } } c[0]=j; if(c[j+1]>0) c[0]++; for(int i=c[0]; i>=1; i--) { if(x==false&&c[i]==0) continue; x=true; cout<<c[i]; } printf("\n"); return 0; }
-
-12019-11-17 10:07:35@
本蒟蒻的第一篇题解
结构体+选排
#include<bits/stdc++.h> using namespace std; struct eee { char xibu,ganbu; string name; int pjcj,pycj,lws; long long RMB=0; }; eee a[101]; int n; long long sum=0; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i].name; cin>>a[i].pjcj>>a[i].pycj; cin>>a[i].ganbu>>a[i].xibu; cin>>a[i].lws; if(a[i].lws>=1&&a[i].pjcj>=81) a[i].RMB+=8000; if(a[i].pjcj>85&&a[i].pycj>80) a[i].RMB+=4000; if(a[i].pjcj>90) a[i].RMB+=2000; if(a[i].pjcj>85&&a[i].xibu=='Y') a[i].RMB+=1000; if(a[i].ganbu=='Y'&&a[i].pycj>80) a[i].RMB+=850; sum+=a[i].RMB; } for(int i=1;i<=n-1;i++) for(int j=i+1;j<=n;j++) if(a[i].RMB<a[j].RMB) { swap(a[i].ganbu,a[j].ganbu); swap(a[i].lws,a[j].lws); swap(a[i].name,a[j].name); swap(a[i].pjcj,a[j].pjcj); swap(a[i].pycj,a[j].pycj); swap(a[i].RMB,a[j].RMB); swap(a[i].xibu,a[j].xibu); } cout<<a[1].name<<endl; cout<<a[1].RMB<<endl; cout<<sum<<endl; return 0; }
-
-12019-11-13 21:30:54@
dalao们求一发模拟退火的题解OuO
-
-12019-10-26 14:17:06@
本题链接:https://vijos.org/p/1000
JieKe08的第1篇题解!for beginners,特设此题,^_^
#include<bits/stdc++.h>//多美妙的万能头 using namespace std; int main() { int a,b;//定义变量 cin>>a>>b;//输入 cout<<a+b;//输出,最后的换行可有可无 return 0;//题目给的代码没有这个,但考试最好加上 }
感谢您花费1分钟阅读鄙人的题解!
-
-12019-09-25 20:22:56@
快读你们懂得吧
cpp
#include<bits/stdc++.h>
using namespace std;
int a,b;
inline int read(){
int ret=0,f=1;char ch=getchar();
while(!isdigit(ch)) f=(ch=='-'?-f:f),ch=getchar();
while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();
return ret*f;
}
int main(){
a=read(),b=read();
printf("%d\n",a+b);
return 0;
}
-
-12019-09-11 20:20:15@
//最简做法 #include<cstdio> int main() { int a,b; scanf("%d%d",&a,&b); printf("%d",a+b); return 0; }
-
-12019-08-31 15:03:02@
#include <bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }
-
-12019-08-27 18:04:02@
Python3
cpp
a,b = map(int,input().split())
print(a + b)
-
-12019-08-19 15:15:03@
任何一个伟大的思想,都有一个微不足道的开始。
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin>>a>>b; cout<<a+b; return 0; } >当快读来帮忙: ```cpp #include<bits/stdc++.h> using namespace std; int a,b; int read() { int r=0,f=1; char c=getchar(); while((c<'0'||c>'9')&&c!='-') c=getchar(); if(c=='-') f=-1,c=getchar(); while(c<='9'&&c>='0') r=r*10+c-'0',c=getchar(); return r*f; } int main() { a=read(); b=read(); printf("%d",a+b); return 0; }
之后还有高精度:
#include <bits/stdc++.h> #define ri register int #define maxn 510 using namespace std; string s1,s2; int a[maxn],b[maxn],c[maxn],la,lb,len; int main() { getline(cin,s1); getline(cin,s2); if(s1[0]==48&&s2[0]==48){ printf("0"); return 0; } la=s1.size(); lb=s2.size(); for(ri i=0;i<la;i++) a[la-i-1]=s1[i]-48; for(ri i=0;i<lb;i++) b[lb-i-1]=s2[i]-48; len=max(la,lb); for(ri i=0; i<len; i++) { c[i]+=a[i]+b[i]; c[i+1]=c[i]/10; c[i]%=10; } len++; while(c[len]==0) len--; for(ri i=len; i>=0; i--) printf("%d",c[i]); return 0; }
-
-12019-08-16 14:01:12@
#include<bits/stdc++.h>//万能头文件
using namespace std;
int a,b,c;//定义
int main()//主程序
{
scanf("%d%d",&a,&b);//比cin快的输入
c=a+b;//幼儿园加减法
printf("%d",c);//比cout快的输出
return 0;//返回并退出
}//over -
-12019-07-21 17:27:29@
利用
c++
中类(class
)的构造函数以及析构函数(Constructor & Destructor
)输入输出。(真的不会超时,一共就*12ms*)
```cpp
#include<bits/stdc++.h>
using namespace std;
class AplusBproblem{
public:
AplusBproblem(){
cin>>x>>y;
}
~AplusBproblem(){
cout<<x+y<<endl;
}
private:
int x,y;
};
int main(){
AplusBproblem beginner;
return 0;
}**跟大家唠嗑两句,此题看似简易,实则内涵丰富,其解法更是犇上加犇,迄今为止已有不下```1<<5```种解法。大家一定要灵活运用知识,思维要开放。**
-
-12019-07-15 18:26:05@
张测试
测试下 md
-
-12019-07-12 22:32:35@
基础题(入门)
#include <iostream> using namespace std; int main() { int a, b, c; cin>>a>>b; c=a+b; cout<<c<<endl; return 0; }
类似题:洛谷P3954
-
-12019-07-11 18:25:30@
我的第一篇题解
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << endl; }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << endl; }
-
-12019-07-11 18:19:50@
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << endl; }
-
-12019-07-10 11:47:38@
废话少说,高精,上!!!(C++)
#include<bits/stdc++.h>//万能头 using namespace std; int a1[1000],a2[1000],c[1000]; int main(){ string s1,s2; int l1,l2,lc; cin>>s1>>s2;//输入 l1=s1.size(); l2=s2.size(); lc=max(l1,l2); for(int i=0;i<=l1-1;i++){ a1[i]=s1[l1-i-1]-'0'; } for(int i=0;i<=l2-1;i++){ a2[i]=s2[l2-i-1]-'0'; } for(int i=0;i<=lc-1;i++){ c[i]+=a1[i]+a2[i]; if(c[i]>=10){ c[i]%=10; c[i+1]++; } } if(c[lc]!=0) lc++; while(c[lc-1]==0 && lc!=1) lc--; //防止最高位为零 for(int i=lc-1;i>=0;i--) cout<<c[i]; //输出 return 0; }
LCT:
#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; }
正解:
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }
-
-12019-07-10 11:46:55@
废话少说,高精,上!!!(C++)
#include<bits/stdc++.h>//万能头 using namespace std; int a1[1000],a2[1000],c[1000]; int main(){ string s1,s2; int l1,l2,lc; cin>>s1>>s2;//输入 l1=s1.size(); l2=s2.size(); lc=max(l1,l2); for(int i=0;i<=l1-1;i++){ a1[i]=s1[l1-i-1]-'0'; } for(int i=0;i<=l2-1;i++){ a2[i]=s2[l2-i-1]-'0'; } for(int i=0;i<=lc-1;i++){ c[i]+=a1[i]+a2[i]; if(c[i]>=10){ c[i]%=10; c[i+1]++; } } if(c[lc]!=0) lc++; while(c[lc-1]==0 && lc!=1) lc--; //防止最高位为零 for(int i=lc-1;i>=0;i--) cout<<c[i]; //输出 return 0; }
LCT:
#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; }
正解:
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }
-
-12019-07-10 11:46:08@
废话少说,高精,上!!!(C++)
#include<bits/stdc++.h>//万能头 using namespace std; int a1[1000],a2[1000],c[1000]; int main(){ string s1,s2; int l1,l2,lc; cin>>s1>>s2;//输入 l1=s1.size(); l2=s2.size(); lc=max(l1,l2); for(int i=0;i<=l1-1;i++){ a1[i]=s1[l1-i-1]-'0'; } for(int i=0;i<=l2-1;i++){ a2[i]=s2[l2-i-1]-'0'; } for(int i=0;i<=lc-1;i++){ c[i]+=a1[i]+a2[i]; if(c[i]>=10){ c[i]%=10; c[i+1]++; } } if(c[lc]!=0) lc++; while(c[lc-1]==0 && lc!=1) lc--; //防止最高位为零 for(int i=lc-1;i>=0;i--) cout<<c[i]; //输出 return 0; }
LCT:
#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; }
正解:
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 74801
- 已通过
- 28644
- 通过率
- 38%
- 被复制
- 250