1 条题解

  • 0
    @ 2024-12-24 9:14:32

    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
    558
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者