제출 #28314

#제출 시각아이디문제언어결과실행 시간메모리
28314이제 내가 두목이다~ (#68)포도주 시음 (FXCUP2_wine)C++11
0 / 1
0 ms2180 KiB
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <queue>
#include <numeric>
#include <iomanip>
#define ll long long
using namespace std;
// for(int p=Set;p;p=(p-1)&Set)  부분집합원소순회
//cout<<fixed<<setprecision(11)<<(double)m/z<<"\n";
int Gcd(int a,int b){
    if(b==0)return a;
    return Gcd(b,a%b);
} //오버플로우조심
int Lcm(int a,int b){
    return (a*b)/Gcd(a,b);
}//오버 플로우 조심
const int MAXN=200001;
long long ans=0;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m; cin>>n>>m;
    long long before=0;
    for(int i=1;i<=n;i++){
        ll num; cin>>num;
        if(num>before){
            ans+=num-before;
            before=num;
        }
        else{
            before=num;
        }
    }
    cout<<ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...