1 solutions

  • 0
    @ 2024-12-5 18:18:59

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    //	freopen("apple.in","r",stdin);
    //	freopen("apple.out","w",stdout);
    	int i,n,s=0,c=0;
    	bool w=1;
    	cin>>n;
    	while(n>0){
    		if(n%3==1&&w){
    			c=s+1;
    			w=0;
    		}
    		if(n%3!=0){
    			n-=(n/3+1);
    		}else{
    			n-=n/3;
    		}
    		s++;
    	}
    	cout<<s<<" "<<c;
    	return 0;
    }
    
    
    • 1

    Information

    ID
    9134
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By