3 solutions

  • 1
    @ 2026-9-16 19:02:21
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int m,n;
    	while(cin>>n>>m,n||m)
    	{
    		int s=0;
    		int k=0;
    		while(n&&m)
    		{
    			if(n%10+m%10+k>=10)
    			{
    				k=1;
    				s++;
    			}
    			else
    			{
    				k=0;
    			}
    			n/=10,m/=10;
    		}
    		cout<<s<<endl;
    	}
    	return 0; 
    }
    
    • 1
      @ 2025-7-15 11:07:16
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n,m;
          while(cin>>n>>m,n||m)
          {
          	int s=0;
          	int k=0;
          	while(n&&m)//n和m不同时为0 
          	{
          		if(n%10+m%10+k>=10)//如果有进位 
          		{
          			k=1;
          			s++;
      			}
      			else//如果没有进位 
      			{
      				k=0;
      			}
      			n/=10,m/=10;//两个数省略个位 
      		}
      		cout<<s<<endl;
      	}
      	return 0;
      }
      • -3
        @ 2025-7-11 10:58:14
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	int k=0;
        	for(int i=1;i<=999;i++){
        		int n,m;
        		cin>>n>>m;
        		int g=n%10;
        		int s=n/10%10;
        		int b=n/100;
        		int g1=m%10;
        		int s1=m/10%10;
        		int b1=m/100;
        		if(n==0&&m==0){
        			return 0;
        		}
        		if(g+g1>=10){
        			s++;
        			k++;
        		}
        		if(s+s1>=10){
        			b++;
        			k++;
        		}
        		if(b+b1>=10){
        			k++;
        		}
        		cout<<k<<endl;
        		k=0;
        		g=0;
        		g1=0;
        		s=0;
        		s1=0;
        		b=0;
        		b1=0;
        	}
        	return 0;
        }
        
        • 1

        Information

        ID
        2846
        Time
        1000ms
        Memory
        64MiB
        Difficulty
        3
        Tags
        # Submissions
        91
        Accepted
        33
        Uploaded By