一年多没写题了,暑假稍微恢复一下
现在大概是普及组水平
恢复一下
-------------------------------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a,b; int main(){ freopen ( "1000.in" , "r" ,stdin); freopen ( "1000.out" , "w" ,stdout); scanf ( "%d %d" ,&a,&b); printf ( "%d\n" ,a+b); return 0; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include<cstdio> #include<set> #include<algorithm> using namespace std; int n; long long ans; set< long long > St; set< long long >::iterator I; long long Abs( long long x){ return x>0?x:-x;} long long Min( long long x, long long y){ return x<y?x:y;} int main(){ freopen ( "1588.in" , "r" ,stdin); freopen ( "1588.out" , "w" ,stdout); scanf ( "%d" ,&n); while (n--){ long long sv,tp; scanf ( "%lld" ,&sv); if (St.empty()){St.insert(sv);ans=sv;} else {I=St.lower_bound(sv);tp=Abs(sv-*I); if (I!=St.begin())ans+=Min(tp,Abs(*--I-sv)); else {ans+=tp;}St.insert(sv);} } printf ( "%lld\n" ,ans); return 0; } |
正在恢复中...
3 年前
Deliveroo student discounts & voucher codes 2021. Sorry, Deliveroo isn't offering a student discount through Student Beans right now. deliveroo promo code student Register now and be the first to know when a Deliveroo student discount. Deliveroo student Discount Policy. Deliveroo is offering student benefits to consumers, You can get the discount only if you prove your student identity.Deliveroo student discounts & voucher codes 2021. Sorry, Deliveroo isn't offering a student discount through Student Beans right now.