2 条题解

  • 0
    @ 2025-4-14 19:57:22
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n,m=0,b=0;
        cin>>n;
        while(n%4==0){
            m++;
            n=n/4;
        }
        while(n%7==0){
            b++;
            n=n/7;
        }
        cout<<m<<" "<<b;
        return 0;
    }
    
    • 0
      @ 2024-12-22 11:03:58

      C++ :

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int a,x=0,y=0;
      	cin>>a;
      	while(a%4==0){
      		x++;
      		a=a/4;
      	}
      	while(a%7==0){
      		y++;
      		a=a/7;
      	}
      	cout<<x<<" "<<y<<endl;
      	return 0;	
      }
      

      Python :

      # coding=utf-8
      x = int ( input () )
      i = 0
      j = 0
      while ( ( x % 4 ) == 0 ):
          x //= 4
          i += 1
      while ( ( x % 7 ) == 0 ):
          x //= 7
          j += 1
      print (i, j)
      
      • 1

      信息

      ID
      145
      时间
      1000ms
      内存
      128MiB
      难度
      10
      标签
      递交数
      2
      已通过
      2
      上传者