Codeforces 1136 - A/B/C/D/E/F - (Undone)
Posted dilthey
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces 1136 - A/B/C/D/E/F - (Undone)相关的知识,希望对你有一定的参考价值。
链接:https://codeforces.com/contest/1136/
A - Nastya Is Reading a Book - [二分]
#include<bits/stdc++.h> using namespace std; const int maxn=105; int n,l[maxn],r[maxn],k; int srch(int x) { int L=1, R=n; while(L<R) { int M=(L+R)>>1; if(l[M]<=x && x<=r[M]) return M; else if(x<l[M]) R=M-1; else L=M+1; } return L; } int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin>>n; for(int i=1;i<=n;i++) cin>>l[i]>>r[i]; cin>>k; cout<<n-srch(k)+1<<endl; }
B - Nastya Is Playing Computer Games - [思维题]
题解:我只想说,这道思维题有点东西……
AC代码:
#include<bits/stdc++.h> using namespace std; int n,k; int main() { cin>>n>>k; cout<<3*n+min(n-k,k-1)<<endl; }
以上是关于Codeforces 1136 - A/B/C/D/E/F - (Undone)的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round 438 A B C D 四个题
Educational Codeforces Round 41 A B C D E
Codeforces 1062 - A/B/C/D/E - (Undone)
Codeforces 1114 - A/B/C/D/E/F - (Undone)