孩子,我无敌了(2.0版,67行)
2025-03-02 18:37:50
发布于:辽宁
未成年码将请在成年码王的陪同下观看,否则会引起“bushi”(确信)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1010;
int RAND_1(ll a,ll b){
ll n = a + b;
return n;
}
int RAND_2(string a, string b, int n[500], int m[500], int ans[501]){
for(int i = 0; i < a.size(); i++)
n[i] = a[a.size() - i - 1] - '0';
for(int i = 0; i < b.size(); i++)
m[i] = b[b.size() - i - 1] - '0';
int len_maxn = max(a.size(), b.size()) + 1;
for(int i = 0; i < len_maxn; i++)
{
ans[i] = n[i] + m[i] + ans[i];
if(ans[i] > 9)
{
ans[i + 1]++;
ans[i] = ans[i] % 10;
}
}
while(ans[len_maxn - 1] == 0 && len_maxn > 0) len_maxn--;
for(int i = len_maxn - 1; i >= 0; i--) cout << ans[i];
return 0;
}
int RAND_3(ll a, ll b){
ll ans = 0;
for(int i = 0; i < a; i ++ ) {
ans ++;
}
for(int i = 0; i < b; i ++ ) {
ans ++;
}
return ans;
}
int n[1010], m[1010],c[1010];
int main(){
srand(time(0));
ll a , b;
string z , y;
int x;
x = 1 + rand() % 3;
if(x == 1){
cin >> a >> b;
int ans = RAND_1(a,b);
cout << ans;
}
if(x == 2){
cin >> z >> y;
RAND_2(z , y , n , m, c);
}
if(x == 3){
cin >> a >> b;
int ans = RAND_3(a, b);
cout << ans;
}
return 0;
}
同样是可以过得好吧
看完的点个赞吧!!!!!!!!!!!!!
全部评论 31
点赞!投币!一键三连!
2024-06-09 来自 辽宁
3不了一点
2024-06-09 来自 辽宁
3加个#include <cmath>
2024-11-03 来自 广东
0吐s了,只能帮你帮到这了:
#include<iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
#include<string>
#include<cstring>
#include<list>
#include<map>
#include<queue>
#include<iterator>
#include<stack>2024-11-03 来自 广东
0
999
2024-08-18 来自 河北
2看完的点个赞吧!!!!!!!!!!!!!
2024-06-09 来自 辽宁
2# include <bits/stdc++.h> typedef unsigned long long ull; #define LL long long \ #define u1 u << 1 \ #define u2 u1 | 1 \ #define ef ((l + r) >> 1)\ using namespace std ; int r() { short f = 1; int x = 0; char c; c = getchar(); while (c < '0' || c > '9') { if (c == '-') { f = -1; } c = getchar(); } while (c >= '0' && c <= '9') { x = (x << 1) + (x << 3) + (c ^ (3 << 4)); c = getchar(); } return x * f; } void w(int x) { if(x == 0) { putchar('0'); return; } w(x / 10); char aaa = 'A'; aaa += (x % 10); putchar(aaa); return; } const int N = 1e5 + 3; struct Node{ LL sum; LL tag; }; int n, m; LL a[N]; Node seg[N << 2]; void pushup(int u) { int aaa = seg[u1].sum; aaa += seg[u2].sum; seg[u].sum = aaa; } void pushdown(int u, int l, int r) { LL &x = seg[u].tag; seg[u1].tag += x; seg[u2].tag += x; int mid = ef; LL aaa = mid - l + 1; LL aaa1 = r - mid; seg[u1].sum += 1ll * aaa * x; seg[u2].sum += 1ll * aaa1 * x; seg[u].tag = 0; } void build(int u, int l, int r) { if (l == r) { seg[u].sum = a[l]; seg[u].tag = 0; return; } int mid = ef; build(u1, l, mid); build(u2, mid + 1, r); pushup(u); } void modify(int u, int l, int r, int ql, int qr, int x) { if(l == ql && r == qr) { int aaa = r - l + 1; seg[u].tag += x; seg[u].sum += 1ll * aaa * x; return; } pushdown(u, l, r); int mid = ef; if(qr <= mid) { modify(u1, l, mid, ql, qr, x); } else if(ql > mid) { modify(u2, mid + 1, r, ql, qr, x); } else { modify(u1, l, mid, ql, mid, x); modify(u2, mid + 1, r, mid + 1, qr, x); } pushup(u); } LL query(int u, int l, int r, int ql, int qr) { if (l == ql && r == qr) { return seg[
2025-04-06 来自 江西
1u].sum; } pushdown(u, l, r); int mid = ef; if (qr <= mid) { return query(u1, l, mid, ql, qr); } else if (ql > mid) { return query(u2, mid + 1, r, ql, qr); } else { int aaa = query(u1, l, mid, ql, mid); aaa += query(u2, mid + 1, r, mid + 1, qr); return aaa; } } int dfs(int a, int b) { if (b == 0) { return a; } int aaa = dfs(a, b - 1); aaa ++; return aaa; } const int e3 = 1000; int main ( ) { int a, b; a = r(); b = r(); build(1, 1, e3); modify(1, 1, e3, 1, 1, a); modify(1, 1, e3, 2, 2, b); int aaa = query(1, 1, e3, 1, 2), aaa1 = dfs(a, b); if(aaa == aaa1) { int l = aaa, r = aaa1; int mid = ef; cout << ef; } cout << " "; cout << endl; return 0; }
2025-04-06 来自 江西
0共行(
2025-04-06 来自 江西
0
不久i是高精度吗?
2024-08-21 来自 上海
1不光是高精度哦亲~
2024-08-21 来自 辽宁
1
孩纸,你无敌了
2024-07-28 来自 浙江
1so?
2024-07-15 来自 浙江
1yiuwaellyouk?
2024-08-21 来自 广东
1
wdlhz
2024-07-14 来自 广东
16啊
2024-06-11 来自 广东
1再顶
2024-06-09 来自 辽宁
1顶
2024-06-09 来自 辽宁
1顶
2024-08-18 来自 浙江
1
我只能帮你到这了!
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout <<a+b;
return 0;
}2025-03-30 来自 河北
0卧槽,牛逼!
2025-03-02 来自 北京
0大佬教一教我
2025-02-23 来自 四川
0#include <bits/stdc++.h>
using namespace std;
char A[100005], B[100005];
struct node{
short a[100005] = {0};
int len = 0, f = 1;
void _init(char *A){
len = strlen(A);
for(int i = 0; i < len; i++){
a[len - i] = A[i] - '0';
}
}
void print(){
for(int i = len; i >= 1; i--) cout << a[i];//倒序输出
}
node cpy(node a, int dst){//除法的靠右对齐函数
node tmp;
tmp.f = a.f, tmp.len = a.len + dst - 1;
for(int i = 1; i <= a.len; i++){
tmp.a[i + dst - 1] = a.a[i];
}return tmp;
}
bool operator > (node &b){
if(len > b.len) return 1;//比较长度
if(len < b.len) return 0;
for(int i = len; i >= 1; i--){
if(a[i] > b.a[i]) return 1;//逐位比较
if(a[i] < b.a[i]) return 0;
}return 0;
}
bool operator < (node &b){
if(len > b.len) return 0;//比较长度
if(len < b.len) return 1;
for(int i = len; i >= 1; i--){
if(a[i] > b.a[i]) return 0;//逐位比较
if(a[i] < b.a[i]) return 1;
}return 0;
}
bool operator <= (node &b){
return !(*this > b);
}
bool operator >= (node &b){
return !(*this < b);
}
node operator + (node &b){//加法
node c;
c.len = max(len, b.len);
for(int i = 1; i <= c.len; i++){
c.a[i] += a[i] + b.a[i];
if(c.a[i] >= 10) c.a[i + 1], c.a[i] -= 10;//进位
}if(c.a[c.len + 1]) c.len;
while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}
node operator - (node &b){//减法
node c;
if(b > *this){//处理负数情况
swap(*this, b);
c.f = -1;
}
c.len = len;
for(int i = 1; i <= len; i++){
c.a[i] += a[i] - b.a[i];
if(c.a[i] < 0) c.a[i + 1]--, c.a[i] += 10;//借位
}while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}
node operator * (node &b){//乘法
node c;
c.len = len + b.len;
for(int i = 1; i <= len; i++){
int x = 0;
for(int j = 1; j <= b.len; j++){
int weishu = i + j - 1;
c.a[weishu] += x + a[i] * b.a[j];
x = c.a[weishu] / 10;
c.a[weishu] %= 10;
}c.a[i + b.len] = x;
}while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}
node operator / (node &b){//除法(难度突增!)
node c;
if(*this < b) return c;
c.len = len - b.len + 1;
for(int i = c.len; i >= 1; i--){
node tmp = cpy(b, i);//右对齐
while(*this >= tmp){//不断相减
c.a[i]++;
*this -= tmp;
}
}while(c.a[c.len] =2025-02-06 来自 浙江
0#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
char A[100005], B[100005];
struct node{
short a[100005] = {0};
int len = 0, f = 1;
void _init(char *A){
len = strlen(A);
for(int i = 0; i < len; i++){
a[len - i] = A[i] - '0';
}
}
void print(){
for(int i = len; i >= 1; i--) cout << a[i];//倒序输出
}
node cpy(node a, int dst){//除法的靠右对齐函数
node tmp;
tmp.f = a.f, tmp.len = a.len + dst - 1;
for(int i = 1; i <= a.len; i++){
tmp.a[i + dst - 1] = a.a[i];
}return tmp;
}
bool operator > (node &b){
if(len > b.len) return 1;//比较长度
if(len < b.len) return 0;
for(int i = l2025-02-06 来自 浙江
0for(int i = len; i >= 1; i--){
if(a[i] > b.a[i]) return 0;//逐位比较
if(a[i] < b.a[i]) return 1;
}return 0;
}
bool operator <= (node &b){
return !(*this > b);
}
bool operator >= (node &b){
return !(*this < b);
}
node operator + (node &b){//加法
node c;
c.len = max(len, b.len);
for(int i = 1; i <= c.len; i++){
c.a[i] += a[i] + b.a[i];
if(c.a[i] >= 10) c.a[i + 1], c.a[i] -= 10;//进位
}if(c.a[c.len + 1]) c.len;
while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}
node operator - (node &b){//减法
node c;
if(b > *this){//处理负数情况
swap(*this, b);
c.f = -1;
}
c.len = len;
for(int i = 1; i <= len; i++){
c.a[i] += a[i] - b.a[i];
if(c.a[i] < 0) c.a[i + 1]--, c.a[i] += 10;//借位
}while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}
node operator * (node &b){//乘法
node c;
c.len = len + b.len;
for(int i = 1; i <= len; i++){
int x = 0;
for(int j = 1; j <= b.len; j++){
int weishu = i + j - 1;
c.a[weishu] += x + a[i] * b.a[j];
x = c.a[weishu] / 10;
c.a[weishu] %= 10;
}c.a[i + b.len] = x;
}while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}
node operator / (node &b){//除法(难度突增!)
node c;
if(*this < b) return c;
c.len = len - b.len + 1;
for(int i = c.len; i >= 1; i--){
node tmp = cpy(b, i);//右对齐
while(*this >= tmp){//不断相减
c.a[i]++;
*this -= tmp;
}
}while(c.a[c.len] == 0 && c.len > 1) c.len--;
return c;
}node operator % (node &b){//取余
if(*this < b) return *this;
int len = len - b.len + 1;
for(int i = len; i >= 1; i--){
node tmp = cpy(b, i);
while(*this >= tmp){
*this -= tmp;
}
}return *this;
}
node operator ^ (node &b){//乘方
node null;
null.f = -1;
if(b.len > 18) return null;//太大了
node tmp;
tmp.len = tmp.a[1] = 1;
long long t = 0;
for(int i = b.len; i >= 1; i--){//处理成long long
t = t * 10 + b.a[i];
}
while(t){
if(t & 1){
if(len + tmp.len > 1e6) return null;//太大了
tmp *= *this;//乘
}
if(len + len > 1e6) return null;
*this *= *this, t >>= 1;//自乘
}return tmp;
}
void operator += (node &b){
*this = *this + b;
}
void operator -= (node &b){
*this = *this - b;
}
void operator *= (node &b){
*this = *t2025-02-06 来自 浙江
0
#include<iostream> #include<string> #include<vector> using namespace std; string x,y; vector<int> a,b,c; vector<int> add(vector<int> a,vector<int> b){ if(a.size()>b.size()) return add(b,a); int t,x=0; vector<int> c; for(int i=0;i<a.size();i++){ t=a[i]+b[i]+x; c.push_back(t%10); x=t/10; } for(int i=a.size();i<b.size();i++){ t=b[i]+x; c.push_back(t%10); x=t/10; } if(x) c.push_back(x); return c; } void print(vector<int> a){ while(!a.empty()){ cout<<a.back(); a.pop_back(); } return; } int main(){ cin>>x>>y; for(int i=x.size()-1;i>=0;i--) a.push_back(x[i]-'0'); for(int i=y.size()-1;i>=0;i--) b.push_back(y[i]-'0'); c=add(a,b); print(c); return 0; }
2025-01-12 来自 上海
0#include<iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include<string>
#include<cstring>
#include<list>
#include<map>
#include<queue>
#include<iterator>
#include<stack>
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 nodejudge(){return pre->son[1]==this;}
bool nodeisroot()
{
if(pre==lct)return true;
return !(pre->son[1]==this||pre->son[0]this);
}
void node::pushdown()
{
if(thislct||!rev)return;
swap(son[0],son[1]);
son[0]->rev^=1;
son[1]->rev^=1;
rev=0;
}
void nodeupdate(){sum=son[1]->sum+son[0]->sum+data;}
void nodesetson(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(2025-01-05 来自 湖南
0#include<iostream> #include <algorithm> #include <math.h> #include <cmath> #include<string> #include<cstring> #include<list> #include<map> #include<queue> #include<iterator> #include<stack> 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)
2024-12-10 来自 河北
0{ 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; }
2024-12-10 来自 河北
0
有帮助,赞一个