update
This commit is contained in:
parent
234f6f83aa
commit
670ed0868a
44
src/P1969/P1969.cpp
Normal file
44
src/P1969/P1969.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
using ull = unsigned long long;
|
||||
static ull a, b, ans, n;
|
||||
|
||||
template<class T>
|
||||
class ReadNumber{
|
||||
char c;
|
||||
T w,n;
|
||||
public:
|
||||
ReadNumber&operator>>(T &t){
|
||||
c=(char)0,w=1,n=0;
|
||||
while(!isdigit(c)){
|
||||
if constexpr (std::is_signed_v<T>){
|
||||
if(c=='-')w=-1;
|
||||
}
|
||||
c=getchar();
|
||||
}
|
||||
while(isdigit(c)){
|
||||
n=n*10+(c-'0');
|
||||
}
|
||||
t = n*w;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
static ReadNumber<ull> readull;
|
||||
// static auto &is = std::cin;
|
||||
static auto &is = readull;
|
||||
static auto &os = std::cout;
|
||||
|
||||
|
||||
int main(){
|
||||
is>>n;
|
||||
for(size_t i{0};i<n;i++){
|
||||
is>>b;
|
||||
if(a<b){
|
||||
ans+=b-a;
|
||||
}
|
||||
a=b;
|
||||
}
|
||||
os<<ans<<'\n';
|
||||
}
|
Loading…
Reference in New Issue
Block a user