Created
March 9, 2018 20:14
-
-
Save farhapartex/52231c860b543ebf597a54791a539c91 to your computer and use it in GitHub Desktop.
Codeforces 946 A Partition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
Md. Nazmul Hasan | |
Shahjalal University of Science & Technology,Sylhet. | |
hasan08sust@gmail.com | |
***/ | |
#include<iostream> | |
#include<cstdio> | |
#include<stack> | |
#include<queue> | |
#include<map> | |
#include<vector> | |
#include<algorithm> | |
#include<cstring> | |
#include<sstream> | |
#include<cmath> | |
#include <iomanip> | |
using namespace std ; | |
typedef long long ll ; | |
typedef int in ; | |
typedef unsigned long long ull ; | |
const double pi = 2*acos(0) ; | |
#define maxi 40000 | |
#define pf printf | |
#define sc scanf | |
#define pb push_back | |
#define MEM(x,y) (memset((x),(y),sizeof(x))) | |
#define MIN(x,y) ((x) < (y) ? (x) : (y)) | |
#define MAX(x,y) ((x) > (y) ? (x) : (y)) | |
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ; | |
#define new_line pf("\n") | |
#define clear_data(array) memset(array,0,sizeof(array)) | |
#define highest_int 2147483647 | |
int main() | |
{ | |
int n; | |
int data[101]; | |
sc("%d",&n); | |
for(int i=0 ; i<n ; i++) | |
sc("%d",&data[i]); | |
int sum = 0; | |
for(int i=0 ; i<n ; i++) | |
{ | |
if(data[i]<0) | |
data[i] = (-1)*data[i]; | |
sum += data[i]; | |
} | |
pf("%d",sum); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment