解题思路:
注意事项:
参考代码:
#include<iostream> #include<algorithm> using namespace std; const int maxn = 100000+10; typedef struct node{ int c; int L,R; }Node; Node A[110]; int main(void) { int n,m,x; cin>>n>>m; for(int i=1;i<=m;i++) { int L,R,c; cin>>L>>R>>c; A[i].c=c; A[i].L=L; A[i].R=R; } cin>>x; int max=-1; for(int i=1;i<=m;i++) { if((A[i].R-x)*(A[i].L-x)<=0) { max=i; } } if(max==-1) cout<<0; else cout<<A[max].c; return 0; }
0.0分
9 人评分
Hello, world! (C语言代码)浏览:1201 |
【亲和数】 (C语言代码)浏览:541 |
A+B for Input-Output Practice (IV) (C++代码)浏览:677 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:904 |
用筛法求之N内的素数。 (C语言代码)浏览:1255 |
简单的a+b (C语言代码)浏览:573 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:545 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:560 |
出圈】指针malloc版浏览:355 |
小九九 (C语言描述,不看要求真坑爹)浏览:985 |