Skip to content

Instantly share code, notes, and snippets.

@hansen033
Created April 14, 2018 09:00
Show Gist options
  • Save hansen033/b68339b627663158806ad959ef42f3ba to your computer and use it in GitHub Desktop.
Save hansen033/b68339b627663158806ad959ef42f3ba to your computer and use it in GitHub Desktop.
2018/4/12
#include <iostream>
using namespace std;
int main(){
int x;
while (cin>>x){
if (x>0){
cout << x*2-1 << "\n";
} else if (x<0){
cout << x*-2 << "\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment