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; }
By signing up a 大沥中心 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 大沥中心 universal account