欢乐纪中某B组赛【2019.1.21】
生活随笔
收集整理的這篇文章主要介紹了
欢乐纪中某B组赛【2019.1.21】
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
成功翻車
成績
RankRankRank是有算別人的
| 141414 | 2017hzb2017hzb2017hzb | 808080 | 303030 | 000 | 505050 |
| 141414 | 2017wyc2017wyc2017wyc | 808080 | 000 | 303030 | 505050 |
| 141414 | 2017xxy2017xxy2017xxy | 808080 | 303030 | 000 | 505050 |
| 444444 | 2017lw2017lw2017lw | 303030 | 303030 | 000 | 000 |
| 444444 | 2017lrz2017lrz2017lrz | 303030 | 303030 | 000 | 000 |
| 444444 | 2017zyc2017zyc2017zyc | 303030 | 000 | 303030 | 000 |
| 444444 | 2017hjq2017hjq2017hjq | 303030 | 000 | 000 | 303030 |
| 616161 | 2017xjq2017xjq2017xjq | 000 | 000 | 000 | 000 |
正題
T1:jzoj4208?T1:jzoj4208-T1:jzoj4208?線段樹什么的最討厭了【dfsdfsdfs】
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86577063
T2:jzoj4209?T2:jzoj4209-T2:jzoj4209?已經沒有什么好害怕的了【差分】
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86577360
T3:jozj4010?T3:jozj4010-T3:jozj4010?我才不是蘿莉控呢【哈夫曼樹】
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86577658
someofcodesome\ of\ codesome?of?code
T2暴力
#include<cstdio> #include<cstring> #define ll long long using namespace std; const ll XJQ=1e9+7; char s[1001]; ll n,ans[1001],sum,t; int main() {freopen("data.in","r",stdin);freopen("data.ans","w",stdout);scanf("%lld",&t);while(t--){scanf("%s",s+1);n=strlen(s+1);memset(ans,0,sizeof(ans));sum=0;for(ll i=1;i<n;i++){for(ll j=i+1;j<=n;j++){ll left=0;bool flag=1;for(ll k=i;k<=j;k++){if(s[k]=='(') left++;else left--;if(left<0){flag=0;break;}}if(flag&&!left)for(ll k=i;k<=j;k++)ans[k]++;}}for(ll i=1;i<=n;i++)sum+=ans[i]*i%XJQ;printf("%lld\n",sum);} }T2隨機數據
#include<cstdio> #include<cstdlib> #include<ctime> using namespace std; int t,n; int main() {freopen("data.in","w",stdout);srand(time(0));t=10;n=100;printf("10\n");for(int i=1;i<=t;i++){//for(int j=1;j<=n/2;j++)// printf("(");for(int j=1;j<=n;j++)// printf(")");if(rand()&1) printf(")");else printf("(");printf("\n");} }T2 30code
#include<cstdio> #include<cstring> #include<stack> #define ll long long using namespace std; const ll N=1e6+10,XJQ=1e9+7; stack<ll> left,mark,k; ll t,n,ans,sum[N],ks,marks; char s[N]; int main() {freopen("data.in","r",stdin);freopen("data.out","w",stdout);scanf("%lld",&t);while(t--){scanf("%s",s+1);n=strlen(s+1);ks=0;ans=0;marks=0;while(!left.empty()) left.pop();while(!mark.empty()) mark.pop();while(!k.empty()) k.pop();for(ll i=1;i<=n;i++){sum[i]=sum[i-1]+i;if(s[i]==')'&&left.empty())marks=ks=0;else if(s[i]==')'){ll z=(sum[i]-sum[left.top()-1])%XJQ;left.pop();marks=mark.top();mark.pop();ks=k.top();k.pop();ks=(ks+1)%XJQ;(marks+=z*ks)%=XJQ;(ans+=marks)%=XJQ;}else{left.push(i);mark.push(marks);k.push(ks);marks=0;ks=0;}}printf("%lld\n",ans);} }T3 50分code
#include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int N=1e3+10; int t,n,a[N],f[N][N*2]; int main() {scanf("%d",&t);while(t--){scanf("%d",&n);a[n+1]=0;for(int i=n;i>=1;i--)scanf("%d",&a[i]);for(int i=1;i<=n;i++)a[i]+=a[i-1];memset(f,0x3f,sizeof(f));f[0][0]=0;for(int i=1;i<=n;i++){for(int j=n;j>=1;j--)f[i][j]=min(min(f[i][j*2-1],f[i][j*2])+a[i],f[i-1][j-1]);}printf("%d\n",f[n][1]);} }總結
開心,題目難一點就翻車了QVQQVQQVQ。
T1:T1:T1:好像是dfsdfsdfs,就寫了一個,然后發現有一個地方直接寫了return0return\ 0return?0。
愉快爆蛋。
T2:T2:T2:寫了半天,和正解檫肩而過,寫了一個先加后modmodmod就愉快30,不如暴力,不如暴力,不如暴力QVQ$
T3:T3:T3:明顯505050分dpdpdp
QVQVQQVQVQQVQVQ
總結
以上是生活随笔為你收集整理的欢乐纪中某B组赛【2019.1.21】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 路由器怎么安装设置使用怎么配置无线路由器
- 下一篇: 华为云电脑说得都很好华为云电脑好用