hdoj 1050 moving tables

代码:

  1. #include <iostream>
  2. #include <algorithm>
  3. //#include <fstream>
  4. using namespace std;
  5. int f[201];
  6. int main()
  7. {
  8. //ifstream cin("1050_input.txt");   //调试用
  9. int t, n, i, j, s, e;
  10. cin >> t;
  11. while( t-- ){
  12. memset( f, 0, sizeof(f) );
  13. cin >> n; //n=1→200
  14. for( i=0; i<n; i++ ){
  15. cin >> s >> e;  //s=start e=end
  16. s = (s+1)/2;
  17. e = (e+1)/2;
  18. if( s > e ){ //保证s<=e
  19. int temp = s;
  20. s = e;
  21. e = temp;
  22. }
  23. for( j=s; j<=e; j++)
  24. f[j]++;
  25. }
  26. int consume = 0;
  27. for( i=1; i<=200; i++ )
  28. consume = max( consume, f[i] );
  29. cout << consume*10 << endl;
  30. }
  31. //system("pause");
  32. return 0;
  33. }

每个走道被占用几次,说明需要等待几次,所以走道中被占用的最大次数为需要等待的最大时间

hdoj 1050 moving tables

时间: 2024-08-18 17:21:44

hdoj 1050 moving tables的相关文章

hdoj 1050 Moving Tables【贪心区间覆盖】

Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24316    Accepted Submission(s): 8053 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a b

HDOJ 1050 Moving Tables(经典贪心)

Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 24553    Accepted Submission(s): 8116 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a

Hdoj 1050.Moving Tables 题解

Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made

HDU 1050 Moving Tables

Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 23044    Accepted Submission(s): 7749 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a

HDU 1050 Moving Tables (贪心)

Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20302    Accepted Submission(s): 6889 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a

HDU 1050.Moving Tables【细节与方法选取】【8月26】

Moving Tables Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the

HDU 1050 Moving Tables(贪心)

Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made

--hdu 1050 Moving Tables(贪心)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 AC code: #include<stdio.h> #include<string.h> int m[210]; int main(void) { int t,n,i,j,st,en,ma; scanf("%d",&t); while(t--) { memset(m,0,sizeof(m)); scanf("%d",&n)

贪心/Hdu 1050 Moving Tables

#include<cstdio> #include<cstring> using namespace std; int a[220]; int cmax(int a,int b){return a>b?a:b;} int main() { int T; scanf("%d",&T); for (int t=1;t<=T;t++) { int n; scanf("%d",&n); int x,y,xx,yy; int