175 条题解

  • -2
    @ 2025-1-18 17:00:44

    JAVA

    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int a, b;
            a = scanner.nextInt();
            b = scanner.nextInt();
            System.out.println(a + b);
        }
    }****
    
    • -2
      @ 2025-1-17 14:46:41

      #include using namespace std; int main() { int a, b; cin >> a >> b; // 从标准输入读取 a 和 b 的值 int sum = a + b; // 计算 a 和 b 的和 cout << sum << endl; // 将结果输出到标准输出 return 0; } //c++

      • -2
        @ 2025-1-15 13:11:14
        #include<bits/stdc++.h>
        using namespace std;
        int main() 
        {
            int a,b;
            cin>>a>>b;
            cout<<a+b;
            return 0;
        }
        
        • -2
          @ 2025-1-13 15:26:29
          #include <bits/stdc++.h>
          using namespace std;
          string a,b;
          int x[100000],y[100000];
          int z[100000];
          int main(){
          	cin>>a>>b;
          	int len=max(a.size(),b.size());
          	//逆置转整 
          	for(int i=a.size()-1,j=0;i>=0;i--,j++){
          		x[j]=a[i]-'0';
          	}
          	for(int i=b.size()-1,j=0;i>=0;i--,j++){
          		y[j]=b[i]-'0';
          	}
          	//加
          	for(int i=0;i<len;i++){
          		z[i]+=x[i]+y[i];
          		if(z[i]>=10){
          			z[i]-=10;
          			z[i+1]+=1;
          		}
          	}
          	//输出
          	int f=0;//无效输出 
          	for(int i=len;i>=0;i--){
          		if(z[i]!=0){
          			f=1;
          		}
          		if(f==1){
          			cout<<z[i];
          		}
          	}
          	return 0; 
          }
          
          • -2
            @ 2025-1-13 15:25:07

            我直接复制了高精度的代码

            #include <bits/stdc++.h>
            using namespace std;
            string a,b;
            int x[100000],y[100000];
            int z[100000];
            int main(){
            	cin>>a>>b;
            	int len=max(a.size(),b.size());
            	//逆置转整 
            	for(int i=a.size()-1,j=0;i>=0;i--,j++){
            		x[j]=a[i]-'0';
            	}
            	for(int i=b.size()-1,j=0;i>=0;i--,j++){
            		y[j]=b[i]-'0';
            	}
            	//加
            	for(int i=0;i<len;i++){
            		z[i]+=x[i]+y[i];
            		if(z[i]>=10){
            			z[i]-=10;
            			z[i+1]+=1;
            		}
            	}
            	//输出
            	int f=0;//无效输出 
            	for(int i=len;i>=0;i--){
            		if(z[i]!=0){
            			f=1;
            		}
            		if(f==1){
            			cout<<z[i];
            		}
            	}
            	return 0; 
            }
            
            • -2
              @ 2024-12-21 16:27:52

              ~~#include #include

              using namespace std;

              int main() { int a,b; cin >> a >> b; cout << a+b; return 0; }~~

              • -2
                @ 2024-12-5 20:44:13

                #include using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b<<endl; return 0; }

                • -2
                  @ 2024-12-1 19:15:21

                  #include using namespace std; int main() { int a,b; cin>>a>>b; long long c; c=a+b; cout<<c; }

                  • -2

                    #include using namespace std; int a,b; int main(){ cin>>a>>b; cout<<a+b; return 0; }

                    • -2

                      #include using namespace std; int a,b; int main(){ cin>>a>>b; cout<<a+b; return 0; }

                      • -2
                        @ 2024-11-27 11:27:12

                        代码高亮,简洁而有效的注解,思路清晰,便于理解,无冗长板子,不定义非常用宏。

                        说的太好了

                        • -2
                          @ 2024-8-28 19:51:16
                          #include <bits/stdc++.h>
                          using namespace std;
                          int main()
                          {
                          	long long a,b;
                          	cin>>a>>b;
                          	cout<<a+b;
                          	return 0;
                          }
                          
                          
                          • -2
                            @ 2024-8-20 13:25:47
                            #include <bits/stdc++.h>
                            using namespace std;
                            int main()
                            {
                                int a,b;
                                cin>>a>>b;
                                cout<<a+b;
                                return 0;
                            }
                            
                            • -2
                              @ 2024-8-20 11:17:28

                              1

                              • -2
                                @ 2024-8-19 18:23:12

                                A+B Problem 题解

                                #include<bits/stdc++.h>
                                using namespace std;
                                int main(){long long a,b;cin>>a>>b;cout<<a+b;return 0;}
                                

                                推荐题目

                                • -2
                                  @ 2024-8-19 16:20:15

                                  本蒟蒻啥都不会,只能贡献一份小小的码风优良的代码```language

                                  #include <iostream>
                                  using namespace std;
                                  
                                  const int MAX = 1000;
                                  
                                  void change(const string &a1, int a[], int len)
                                  {
                                  	for (int i = 0; i < len; i++)
                                  	{
                                  		a[i] = a1[len - i - 1] - '0';
                                  	}
                                  }
                                  
                                  int main()
                                  {
                                  	string a1, b1;
                                  	cin >> a1 >> b1;
                                  	int lena = a1.size(), lenb = b1.size();
                                  	int a[MAX] = {}, b[MAX] = {}, c[MAX] = {}, cf = 0;
                                  	change(a1, a, lena);
                                  	change(b1, b, lenb);
                                  	int lenc = lena;
                                  	if (lenb > lena)
                                  	{
                                  		lenc = lenb;
                                  	}
                                  	for (int i = 0; i <= lenc; i++)
                                  	{
                                  		c[i] = a[i] + b[i] + cf;
                                  		if (c[i] >= 10)
                                  		{
                                  			cf = 1;
                                  			c[i] -= 10;
                                  		}
                                  		else
                                  		{
                                  			cf = 0;
                                  		}
                                  	}
                                  	int i = lenc;
                                  	if (c[i] == 0)
                                  	{
                                  		i--;
                                  	}
                                  	for (i; i >= 0; i--)
                                  	{
                                  		cout << c[i];
                                  	}
                                  	return 0;
                                  }
                                  • -2
                                    @ 2024-8-19 13:00:40
                                    C++:C++:
                                    #include<bits/stdc++.h> //头文件
                                    using namespace std;//命名空间
                                    int main(){//主函数,程序从这里开始
                                        //signed main也行
                                        long long a,b;
                                        //用long long类型的变量进行存储因为数值范围是10^6,int存不下
                                        cin>>a>>b;
                                        /*
                                          这里可以替换为:
                                          scanf("%lld%lld",&a,&b);
                                        */
                                        long long ans=a+b;
                                        cout<<ans<<endl;
                                        /*
                                          这里可以替换为:
                                          printf("%lld",ans);
                                        */
                                        return 0;//一定要写,不然RE
                                    }
                                    
                                    • -2
                                      @ 2024-8-3 10:04:01

                                      #include using namespace std; int main(){ long long a,b; cin>>a>>b; cout<<a+b; }

                                      • -2
                                        @ 2024-7-15 22:58:04
                                        终于可以写一份A+B这么难的题的题解了。
                                        咦?竟然没有人写LCT的题解?
                                        Link-Cut Tree 会很伤心的!
                                        ORZ为了不让LCT伤心于是我来一份LCT的A+B题解吧!
                                        送上代码:
                                        
                                        #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;
                                        }
                                        

                                        本蒟蒻第一次写题解,请原谅

                                        • @ 2024-7-25 19:06:25

                                          又一个抄洛谷的🤣👉

                                      • -2
                                        @ 2024-7-15 22:54:04
                                        
                                        #include<iostream>//头文件
                                        using namespace std;//使用标准命名空间
                                        int main()//主函数{
                                        	int a,b;
                                        	cin>>a>>b;
                                        	cout<<a+b;
                                        	return 0;//好习惯,拜拜
                                        }

                                        信息

                                        ID
                                        56
                                        时间
                                        1000ms
                                        内存
                                        1024MiB
                                        难度
                                        1
                                        标签
                                        递交数
                                        10304
                                        已通过
                                        4651
                                        上传者