1 solutions

  • 0
    @ 2025-12-2 11:47:19

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    string a;
    int main()
    {
        int n,a,b;
        cin>>n;
        b=n;
        a=10000-b;
        for(int i=0;i<3;i++)
        {
        	b+=a/2;
        	a/=2;
    	}
    	if(b+a==10000)
    	{
    		cout<<b;
    	}
    	else cout<<"-1";
    	
    	return 0;
    } 
    
    • 1

    Information

    ID
    638
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    9
    Tags
    # Submissions
    9
    Accepted
    6
    Uploaded By