200 条题解

  • -2
    @ 2025-5-15 12:31:18

    #include <bits/stdc++.h>

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

    • -2
      @ 2025-4-21 13:54:49

      简单题,直接上

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int a,b;
      	cin>>a>>b;
      	cout<<a+b; 
      }
      
      • -2
        @ 2025-2-13 10:35:01

        这题只要输出两数之和就行了,代码:

        #include<bits/stdc++.h>
        using namespace std;
        signed main(){
        	int a, b;
        	cin >> a >> b;
        	cout << a + b;
        	return 0;
        }
        
        
        • -2
          @ 2024-12-29 14:17:40

          c++

          #include<bits/stdc++.h>
          typedef long long ll;
          using namespace std;
          ll a,b;
          int main(){
          	ios::sync_with_stdio(false);
          	cin.tie(0),cout.tie(0);
          	cin>>a>>b;
          	cout<<a+b<<endl;
          	return 0;
          }
          • -2
            @ 2024-11-26 17:23:15

            曾经的我:

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

            现在的我:

            #include<iostream>
            #include<string>
            using namespace std;
            int n1[501];
            int m1[501];
            int result[501];
            string n,m;
            int main(){
            	cin>>n>>m;
            	int ns,ms;
            	ns=n.size();
            	ms=m.size();
            	for(int i=ns-1,j=1;i>=0;i--,j++){
            		n1[j]=n[i]-'0';
            	}
            	for(int i=ms-1,j=1;i>=0;i--,j++){
            		m1[j]=m[i]-'0'; 
            	}
            	int j=ns>ms?ns:ms;
            	for(int i=1;i<=j;i++){
            		result[i]+=m1[i]+n1[i];
            		result[i+1]=result[i]/10;
            		result[i]=result[i]%10;
            	}
            	if(result[j+1]){
            		j++;
            	}
            	for(int i=j;i>=1;i--){
            		cout<<result[i];
            	}
            	return 0;
            }
            

            感觉没啥变化

            • -2
              @ 2024-11-24 19:42:45

              c++

              #include <iostream>
              using naemspace std;
              
              signed main(){
                int a,b;
                cin>>a>>b;
                cout<<a + b;
                return 0;
              }
              • -2
                @ 2024-11-8 17:44:00

                注:此代码不支持C++23(O2)。

                #include<bits/stdc++.h>
                #define short long long
                #define int long long
                #define float long double
                #define double long double
                #define char wchar_t
                #define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
                using namespace std;
                signed main(){
                    ios;
                    int a,b;//定义a,b
                    cin>>a>>b;//输入a,b
                    cout<<a+b;//输出a+b
                    return 0;//结束程序
                }
                
                • -2
                  @ 2024-11-4 15:00:23

                  #include <stdio.h>

                  int main() { int a,b; scanf("%d%d",&a,&b); printf("%d\n", a+b); return 0; }

                  • -2
                    @ 2024-11-4 15:00:23

                    #include <stdio.h>

                    int main() { int a,b; scanf("%d%d",&a,&b); printf("%d\n", a+b); return 0; }

                    • -2
                      @ 2024-11-2 23:48:26

                      `#include #include

                      using namespace std;

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

                      • -2
                        @ 2024-9-17 7:56:13

                        终于能做一道a+b这么难的题啦! code:

                        #include<bits/stdc++.h> //万能头文件
                        using namespace std; //命名空间
                        long long add(int a,int b){//加法函数(int要爆)
                        cin>>a>>b;
                        for(int i=a;i<=b;i++){//循环相加(也可以地柜)
                        i++;
                        }
                        int main(){
                        int a,b;
                        add(a,b);
                        return 0;
                        }
                        

                        finish

                        • -2
                          @ 2024-9-8 18:02:23

                          这很简单吧?

                          #include <iostream>
                          using namespace std;
                          int main(){
                              int a,b;
                              while(cin>>a>>b){
                                  cout<<a+b;
                              }
                              return 0;
                          }
                          • -2
                            @ 2024-7-31 20:47:03

                            所以写题解会加RP吗?(每日一问)

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

                            以至于我为什么要用long long我也不知道

                            注释: (1):万能头文件,几乎包含所有头文件( (2):换行,比endl快一点

                            • -2
                              @ 2024-7-2 8:21:26

                              第一次写题解😄

                              #include <bits/stdc++.h>//万能头
                              using namespace std;
                              int main() {
                              int a, b;//定义
                              cin >> a >> b;//输入
                              cout << a + b;//输出
                              return 0;//返回
                              }
                              
                              • -2
                                @ 2024-7-1 20:24:17
                                #include<bits/stdc++.h>
                                 using namespace std; 
                                int main()
                                { 
                                    int a, b; 
                                    cin>>a>>b; 
                                    cout<<a+b; 
                                    return 0;
                                }
                                
                                • -2
                                  @ 2024-5-19 21:03:56

                                  A+B作为一道基础题,思维也很简单 看代码:

                                  #include <bits/stdc++.h>
                                  #define endl '\n'
                                  #define int long long
                                  
                                  using namespace std;
                                  
                                  signed main()
                                  {
                                  	int a, b;
                                  	cin >> a >> b;
                                  	cout << a + b; 
                                  	
                                  	return 0;
                                  }
                                  
                                  • -2
                                    @ 2024-4-14 8:31:48

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

                                    • -2
                                      @ 2024-4-14 8:31:46

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

                                      • -2
                                        @ 2024-4-6 11:58:55

                                        经典的 a+ba+b

                                        • -2
                                          @ 2024-4-5 20:01:38
                                          #include
                                          using namespace std;
                                          
                                          struct Node
                                          {
                                          int data;
                                          Node *prev;
                                          Node *next;
                                          Node(int val) : data(val), prev(nullptr), next(nullptr) {}
                                          };
                                          
                                          Node *createList(int num)
                                          {
                                          Node *head = nullptr;
                                          Node *tail = nullptr;
                                          while (num > 0)
                                          {
                                          int digit = num % 10;
                                          Node *newNode = new Node(digit);
                                          if (head == nullptr)
                                          {
                                          head = newNode;
                                          tail = newNode;
                                          }
                                          else
                                          {
                                          newNode->next = head;
                                          head->prev = newNode;
                                          head = newNode;
                                          }
                                          num /= 10;
                                          }
                                          return head;
                                          }
                                          
                                          Node *addTwoNumbers(Node *num1, Node *num2)
                                          {
                                          Node *result = nullptr;
                                          Node *current = nullptr;
                                          int carry = 0;
                                          

                                          while (num1 != nullptr || num2 != nullptr || carry != 0) { int sum = carry;

                                          if (num1 != nullptr)
                                          {
                                              sum += num1->data;
                                              num1 = num1->next;
                                          }
                                          
                                          if (num2 != nullptr)
                                          {
                                              sum += num2->data;
                                              num2 = num2->next;
                                          }
                                          
                                          carry = sum / 10;
                                          sum %= 10;
                                          
                                          Node *newNode = new Node(sum);
                                          
                                          if (result == nullptr)
                                          {
                                              result = newNode;
                                              current = newNode;
                                          }
                                          else
                                          {
                                              current->prev = newNode;
                                              newNode->next = current;
                                              current = newNode;
                                          }
                                          

                                          }

                                          return result;

                                          }
                                          
                                          void printList(Node *head)
                                          {
                                          if (head == nullptr)
                                          {
                                          cout << "Empty list" << endl;
                                          return;
                                          }
                                          

                                          while (head != nullptr) { cout << head->data; head = head->next; } cout << endl;

                                          }
                                          
                                          void deleteList(Node *head)
                                          {
                                          while (head != nullptr)
                                          {
                                          Node *temp = head;
                                          head = head->next;
                                          delete temp;
                                          }
                                          }
                                          
                                          int main()
                                          {
                                          int num1 = 12345;
                                          int num2 = 6789;
                                          

                                          Node *list1 = createList(num1); Node *list2 = createList(num2);

                                          cout << "Number 1: "; printList(list1);

                                          cout << "Number 2: "; printList(list2);

                                          Node *sumList = addTwoNumbers(list1, list2);

                                          cout << "Sum: "; printList(sumList);

                                          deleteList(list1); deleteList(list2); deleteList(sumList);

                                          return 0;

                                          }
                                          
                                          

                                          信息

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