日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

hdu 6205 card card card 尺取+超神读入挂

發布時間:2023/11/27 生活经验 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hdu 6205 card card card 尺取+超神读入挂 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題沒啥好說的?

我就是想把讀入掛記錄一下

?

update(2017-10-03)

把讀入掛加上了調試?

?

 1 #include<bits/stdc++.h>
 2 #define cl(a,b) memset(a,b,sizeof(a))
 3 #define debug(a) cerr<<#a<<"=="<<a<<endl
 4 using namespace std;
 5 typedef long long ll;
 6 typedef pair<int,int> pii;
 7 
 8 const int maxn=1e6+10;
 9 
10 int n;
11 int a[maxn*2];
12 int b[maxn*2];
13 
14 #define JUDGE
15 
16 #ifdef DEBUG
17 inline bool read(int &ret)
18 {
19     if(scanf("%d",&ret)==EOF) return false;
20     return true;
21 }
22 #endif  DEBUG
23 
24 #ifdef JUDGE
25 namespace fastIO {
26     #define BUF_SIZE 100000
27     //fread -> read
28     bool IOerror = 0;
29     inline char nc() {
30         static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
31         if(p1 == pend) {
32             p1 = buf;
33             pend = buf + fread(buf, 1, BUF_SIZE, stdin);
34             if(pend == p1) {
35                 IOerror = 1;
36                 return -1;
37             }
38         }
39         return *p1++;
40     }
41     inline bool blank(char ch) {
42         return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
43     }
44     inline bool read(int &x) {
45         char ch;
46         while(blank(ch = nc()));
47         if(IOerror)
48             return false;
49         for(x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0');
50         return true;
51     }
52     #undef BUF_SIZE
53 };
54 using namespace fastIO;
55 #endif JUDGE
56 
57 int chiqu(int n)
58 {
59     int sum=0,mx=0,ans=0;
60     for(int l=1,r=1; l<=n&&r<=n;)
61     {
62         if(sum>0) sum+=(a[r]-b[r++]);
63         if(r-l+1>=mx)
64         {
65             mx=r-l+1;
66             ans=l-1;
67         }
68         if(sum<=0) sum-=(a[l]-b[l++]);
69     }
70     return ans;
71 }
72 
73 int main()
74 {
75     while(read(n))
76     {
77         for(int i=1; i<=n; i++) read(a[i]);
78         for(int i=1; i<=n; i++) read(b[i]);
79         for(int i=1; i<=n; i++) a[i+n]=a[i],b[i+n]=b[i];
80         int ans=chiqu(2*n);
81 //        debug(ans);
82         printf("%d\n",ans);
83     }
84     return 0;
85 }/*
86 
87 5
88 4 6 2 8 4
89 1 5 7 9 2
90 
91 */

?

轉載于:https://www.cnblogs.com/general10/p/7502667.html

總結

以上是生活随笔為你收集整理的hdu 6205 card card card 尺取+超神读入挂的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。