1328 条题解
-
-1
cs-803 (大傻逼) LV 8 @ 2021-09-21 20:49:28
随便坐
-
-12021-09-21 20:48:59@
-
-12021-09-21 20:48:56@
-
-12021-09-21 20:48:54@
-
-12021-09-21 20:48:52@
-
-12021-09-21 20:48:31@
-
-12021-09-18 20:48:03@
1
-
-12021-09-18 20:48:01@
11
-
-12021-08-07 14:34:11@
#include<bits/stdc++.h> using namespace std; long long a,b; int jiafa(int x,int y)//函数--加法 { return x+y; } int main() { cin>>a>>b;//输入 cout<<jiafa(a,b)<<endl;//输出 return 0; }
-
-12021-07-17 16:07:40@
#include <stdio.h> #include <windows.h> #include <time.h> int main () { int a, b; scanf("%d %d", &a, &b); srand(time(NULL)); for (;;) { int c = rand() % (a + b) + 1; if (c == a + b) { printf("%d", c); return 0; } } }
这题去年IOI最难的,正解随机数,无他解,其他的都是牛马题解!!!!
虽然这是正解,但还是有可能TLE!!!! -
-12021-07-12 09:53:40@
#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); connect(A,B); cut(A,B); connect(A,B); printf("%d\n",query(A,B)); return 0; }
-
-12021-07-12 09:53:30@
*
*#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); connect(A,B); cut(A,B); connect(A,B); printf("%d\n",query(A,B)); return 0; }*
*
-
-12021-05-04 16:28:02@
#include <iostream> using namespace std; int main () { int a,b; cin >> a >> b; cout << a+b << endl; }
-
-12021-03-20 11:25:18@
#include <iostream>
int main()
{
int a,b;
std::cin>>a>>b;
std::cout<<a+b;
return 0;
} -
-12021-02-14 19:00:22@
#include <iostream> using namespace std; int main() { int a,b,*p,*q;cin>>a>>b; p=&a;q=&b; cout<<*p+*q; return 0; }
-
-12021-02-13 18:52:45@
#include<iostream> using namespace std; int main() { int a[2]; int sum; for(int i=0;i<2;i++) cin>>a[i]; for(int i=0;i<2;i++) sum+=a[i]; cout<<sum; }
-
-12021-02-05 09:21:15@
这道题还是比较基础的,按题意输入输出就行了
#include<bits/stdc++.h> using namespace std; int a, b; int main() { scanf("%d%d", &a, &b); printf("%d", a + b); return 0; }
-
-12021-02-01 17:17:37@
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
} -
-12021-01-22 16:14:20@
用加法原理写的奇怪代码
cpp
#include <stdio.h>
int plus(int a, int b) {
int t = a ^ b, n = a & b;
if (!n) return t;
return plus(t, n << 1);
}
int main() {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", plus(a, b));
return 0;
}
-
-12020-12-20 16:25:29@
#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