3 条题解

  • 1
    @ 2023-10-21 20:29:16
    #include<iostream>
    using namespace std;
    int main(){
        int a,b;
        while(cin>>a>>b){
            if(a==0&&b==0)
            break;
            int i=0,a1,a2,a3,b1,b2,b3;
            a1=a%10;
            a2=a/10%10;
            a3=a/100;
            b1=b%10;
            b2=b/10%10;
            b3=b/100;
            if(a1+b1>=10){
            i++;
    		a2++;	
    		}
            if(a2+b2>=10){
            	i++;
            	a3++;
    		}
            if(a3+b3>=10)
            i++;
            cout<<i<<endl;
        }
    }
    
    • 0
      @ 2023-12-10 13:28:24
      #include<stdio.h>
      int main(){
          int a,b;
          scanf("%d %d",&a,&b);
          while(a||b){
              int i=0;
              while(a&&b){
                  if(a%10+b%10>=10){
                      i++;
                      a=a/10+1;
                      b/=10;
                  }
                  else{
                  a/=10;
                  b/=10;   
                  }
                    
              }
              printf("%d\n",i);
              scanf("%d %d",&a,&b);
          }
          return 0;
      }
      
      • 0
        @ 2023-9-28 8:59:51
        #include <stdio.h>
        int main()
        {
            int a,b,t,x1,x2,y1,y2,z1,z2;
            while(scanf("%d%d",&a,&b),a!=0&&b!=0)
            {
                t=0;
                x1=a%10;
                y1=a/10%10;
                z1=a/100;
                x2=b%10;
                y2=b/10%10;
                z2=b/100;
                if(x1+x2>=10)//确定个位是否进位
                {
                    t++;
                    if(y1+y2+1>=10)//个位进位十位相加需+1
                    {
                        t++;
                        if(z1+z2+1>=10)//十位进位百位+1
                        {
                            t++;
                        }
                    }
                    else//十位不进位
                    {
                        if(z1+z2>=10)
                        {
                            t++;
                        }
                    }
                }
                else//个位不进位
                {
                    if(y1+y2>=10)//十位进位
                    {
                        t++;
                        if(z1+z2+1>=10)
                        {
                            t++;
                        }
                    }
                    else//十位不进位
                    {
                        if(z1+z2>=10)
                        {
                            t++;
                        }
                    }
         
                }
                printf("%d\n",t);
            }
            return 0;
        }
        
        • 1

        信息

        ID
        151
        时间
        3000ms
        内存
        128MiB
        难度
        6
        标签
        (无)
        递交数
        775
        已通过
        258
        上传者