114 条题解

  • -2
    @ 2023-3-23 20:06:20
    #include<bits/stdc++.h>//万能头文件
    using namespace std;//使用标准命名空间
    int main()//主函数
    {
    	int a,b;
    	cin>>a>>b;
    	cout<<a+b;
    	return 0;
    }
    ~~太简单了~~
    
    • -2
      @ 2023-3-20 15:48:05

      很简单,先用字符串存放数据,在从低位开始算,两两相加,逢十进一。

      ~代码才40行,不多~

      #include<bits/stdc++.h>
      using namespace std;
      int a[1000001],b[1000001],c[1000001],j;
      bool x=false;
      char s[1000001],ss[1000001];
      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];
      	}
      	if(x==false) 
      	cout<<0;
      	printf("\n");
      	return 0;
      }
      

      管理员大大求过QAQ

      彩蛋

      文言版

      #及充窦融之女孙侍中垒兴矣。
      用命名为帝喾咨d
      甲戌,武军二千人[71]以五十吏二千人,吏二千人五十余年;
      &lt;
      甲戌,封府库二千二千余家,帝喾二千余家;
      &lt
      {
      更老女喜刑名。帝喾寿梦有子;
      更典帝喾嘉伯喈①,吾寿梦有子②;
      更典帝喾嘉伯喈。
      帝喾八月壬戌岂可怒哉!帝喾聿怀金玉,为帝喾次妃。
      [47]陈民典诰。
      [47]民义并行。
      猫一窦秋开二水中;
      [88]唐赛明之后[82]--][57]
      猫一窦秋开二水中;
      [88]唐广明年金涂海伯萧][57]-
      刘保好心,好梦回漠北;无如之何。
      {
      [88]刘宇深,[88];
      吾乃龌龊。
      {
      [88]徐卢=;
      [88]唐武爱吾;
      }
      }
      [88]
      [88]聚野草花,疏刑部伍胥靡];
      了窦融一窦通漾场;
      {
      若孝明旦唱为帝喾做成何人,
      引兵久之。
      蜥蜴_然;
      功名吟泽,无片云;
      }
      若(旦旦唱)
      co mán)42 30。
      乐则灵惨凄部(lya n.
      还。
      }
      
      • @ 2023-7-29 12:46:32

        a,b106a,b\le 10^6,用传统数据类型不能存吗?为什么用高精度加?

      • @ 2023-10-3 19:26:30

        @ 他炫技呗,别管这种人

    • -2
      @ 2023-3-9 10:28:01

      这道题很简单

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
          int a,b;
          cin>>a>>b;
          cout<<a+b;
          return 0;
      }
      
      • -2
        @ 2023-3-3 14:47:23

        很简单,适合刚学信息的同学。

        代码:

        
        
        #include<iostream>//头文件
        using namespace std;
        
        int main()//主函数
        {
        int a,b;//定义a和b
        cin>>a>>b;//输入
        cout<<a+b<<endl;//输出a+b并换行
        return 0;//程序结束后,返回0,也可以不写```}
        • -2
          @ 2023-2-26 10:43:36

          CODE:

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

          求赞!

          • -2
            @ 2023-1-14 10:49:39

            A+B难度居然有1 c++风格

            #include<bits/stdc++.h>//好习惯
            int main(){//主函数
            std::ios::sync_with_stdio(0);
            std::cin.tie(0);
            std::cout.tie(0);//可要可不要,是用来加速cin cout的,相关信息可以百度
            int a,b;
            std::cin>>>b;//因为cin是在std空间定义,我不写using就要在前面加std::
            std::cout<<a+b;//建议还是加using namespace std,不然不太方便
            }
            

            c风格

            #include<stdio.h>
            int main(){
            int a,b;
            scanf("%d%d",&a,&b);//%d是声明变量类型,&a是返回变量地址,直接变量名会出错
            printf("%d",a+b);//%d同上,a+b是计算
            //注意:c语言中没有using namespace std
            }
            

            其他不会

            • -2
              @ 2023-1-4 22:36:13
              #include<stdio.h>
              int main()
              {
                  int a,b;
                  scanf("%d%d",&a,&b);
                  printf("%d",a+b);
                  return 0;
              }
              
              • -2
                @ 2022-12-31 16:20:38
                #include<iostream> //头文件
                using namespace std; //命名空间
                int main(){ //主函数,程序从这里开始
                    int a,b; //定义变量
                    cin>>a>>b; //输入
                    cout<<a+b<<endl; //输出他们的和
                    return 0; //主函数需要返回0
                }
                
                
                • -2
                  @ 2022-12-29 20:42:45
                  #include<iostream>
                  #define I int a,b;
                  #define AK cin>>a>>b;
                  #defing IOI cout<<a+b
                  using namespace std;
                  int main()
                  {
                      I AK IOI;
                      return 0;
                  }
                  
                  • -2
                    @ 2022-12-7 21:28:42
                    #include <iostream> //头文件
                    
                    using namespace std; //如果没有这一句,将无法正常使用cin, cout;
                    
                    int main () { //主函数
                        int a, b; //定义,c++的变量必须先定义才能使用
                        cin >> a >> b; //输入,相当于键入赋值
                        cout << a + b << endl; //输出,endl指换行
                        return 0; //结束程序
                    }
                    
                    • -2
                      @ 2022-11-22 16:02:23
                      #include <bits/stdc++.h>
                      using namespace std;int a,b;int main(){cin>>a>>b;cout<<a+b<<endl;return 0;}
                      
                      • -2
                        @ 2022-11-20 18:23:45

                        非常简单的一道题,输出a+b的和即可。

                        代码:

                        #include<cstdio>//C语言风格输入输出头文件
                        int main(){ //主函数
                            int a,b;//定义变量
                            scanf("%d%d",&a,&b);//输入a和b
                            printf("%d",a+b);//输出a+b
                            return 0; //返回值
                        }
                        
                        • -2
                          @ 2022-11-7 19:23:40

                          package luogu; import java.util.Scanner; public class a1 {

                          public static void main(String[] args) {
                          	// TODO Auto-generated method stub
                          	int a=0;
                          	int b=0;
                          	Scanner sc=new Scanner(System.in);
                          	for(int i=1;i<=2;i++) {
                          	System.out.print("\t");
                          	a=sc.nextInt();
                          	b=sc.nextInt();
                          	int c=a+b;
                          	System.out.println(c);
                          }
                          }
                          

                          }

                          • -2
                            @ 2022-10-6 14:31:17
                            
                            
                            #include<bits/stdc++.h>
                            
                            using namespace std;
                            
                            int ab(int a,int b)
                            {
                                return a+b;
                            }
                            
                            int main()
                            {
                                int a,b;
                                cin>>a>>b;
                                cout<<ab(a,b);
                            	return 0;
                            }
                            
                            //关于a+b我用函数解这件事
                            
                            • -2
                              @ 2022-8-18 17:11:48

                              甚至连变量都不用的快读。

                              代码如下:

                              #include<bits/stdc++.h>
                              using namespace std;
                              inline int read()
                              {
                                  int x=0;
                                  bool flag=1;
                                  char c=getchar();
                                  while(c<'0'||c>'9')
                                  {
                                      if(c=='-')
                                          flag=0;
                                      c=getchar();
                                  }
                                  while(c>='0'&&c<='9')
                                  {
                                      x=(x<<1)+(x<<3)+c-'0';
                                      c=getchar();
                                  }
                                  return (flag?x:~(x-1));
                              }
                              int main()
                              {
                              	cout<<read()+read();
                              	return 0;
                              }
                              
                              • -2
                                @ 2022-8-17 16:04:20
                                #include<bits/stdc++.h>//万能头文件
                                using namespace std;
                                int main()//主函数
                                {
                                	int a,b;
                                	cin>>a>>b;
                                	cout<<a+b;
                                }
                                
                                • -2
                                  @ 2022-8-5 22:44:17

                                  水题一道,输入 aabb,然后输出他们的和即可。

                                  #include<iostream>
                                  using namespace std;
                                  int main(){
                                      int a, b;
                                      cin >> a >> b;
                                      cout << a + b << endl;
                                      return 0;
                                  }
                                  
                                  • -2
                                    @ 2022-7-25 16:25:22

                                    这是一道基本的题,不会做这道题的都不好意思说自已学过OI (雾)

                                    伪代码

                                    导入头文件
                                    主函数
                                    {
                                        整型 a, b
                                        输入 a, b
                                        输出 a, b
                                    }
                                    

                                    真实代码

                                    #include <bits/stdc++.h>// 万能头
                                    
                                    int main()// 主函数
                                    {
                                        int a, b;// 要加英文分号,int为整型
                                        scanf("%d %d", &a, &b);// 输入,%d是整形输入,&一定要加!!
                                        printf("%d", a + b);// 输出,C/C++支持直接用运算符
                                        return 0;// 返回,代表着程序的结束(注:这条代码只是习惯的问题,觉得麻烦可以不写;返回值一般是0,当然也可以返回别的数)
                                    }
                                    
                                    • -2
                                      @ 2022-6-19 11:30:22

                                      补充一个julialang题解

                                      a=parse(Int, readuntil(stdin, ' '))
                                      b=parse(Int, readline())
                                      print(a+b)
                                      
                                      • -2
                                        @ 2022-5-29 14:48:53

                                        好吧,同志们,我们就从这一题开始,向着大牛的路进发。 任何一个伟大的思想,都有一个微不足道的开始。

                                        #include<bits/stdc++.h>//万能头文件
                                        using namespace std;//使用标准命名空间
                                        int a,b;//定义整型变量a、b,也就是参与运算的两个数
                                        int main(){//主函数,程序在这里运行
                                            cin>>a>>b;//标准输入
                                            cout<<a+b;//标准输出
                                            return 0;//返回值,主函数的返回值必须是0
                                        }
                                        

                                        信息

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