趁着多校之际打了一下这个比赛,low的一批。做了七个题,被虐的不轻
Wave HDU - 6570
Avin is studying series. A series is called “wave” if the following conditions are satisfied:

  1. It contains at least two elements;
  2. All elements at odd positions are the same;
  3. All elements at even positions are the same;
  4. Elements at odd positions are NOT the same as the elements at even positions.
    You are given a series with length n. Avin asks you to find the longest “wave” subseries. A subseries is a subsequence of a series.
    Input
    The first line contains two numbers n, c (1 ≤ n ≤ 100, 000, 1 ≤ c ≤ 100). The second line contains n integers whose range is [1, c], which represents the series. It is guaranteed that there is always a “wave” subseries.
    Output
    Print the length of the longest “wave” subseries.
    Sample Input
    5 3
    1 2 1 3 2
    Sample Output
    4
    首先,n很大,1e5。但是我们发现这个c很小。我们可以把每个数的位置记录下来,枚举每两个数他们出现的位置,复杂度不是很大。
    代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;const int maxx=1e2+100;
vector<int> p[maxx];
int n,m;int main()
{while(scanf("%d%d",&n,&m)!=EOF){int x;for(int i=1;i<=m;i++) p[i].clear();for(int i=1;i<=n;i++){scanf("%d",&x);p[x].push_back(i);}int ans=0,maxn=0;int len1,len2,y;for(int i=1;i<=m;i++){for(int j=i+1;j<=m;j++){ans=0;len1=p[i].size();len2=p[j].size();x=y=0;int flag=0;if(p[i][0]<p[j][0]) flag=1;if(flag) x++;else y++;ans++;while(x<len1&&y<len2){if(flag==0){while(p[i][x]<p[j][y-1]&&x<len1) x++;if(x<len1){x++;ans++;flag=1;}else break;if(x==len1){while(y<len2){if(p[j][y]>p[i][x-1]){ans++;break;  }y++;}break;}}else{//cout<<p[j][y]<<endl;while(p[j][y]<p[i][x-1]&&y<len2) y++;if(y<len2){y++;ans++;flag=0;}else break;if(y==len2){while(x<len1){if(p[i][x]>p[j][y-1]){ans++;break;}x++;}break;}}}maxn=max(maxn,ans);}}printf("%d\n",maxn);}
}

String HDU - 6572
Avin has a string. He would like to uniform-randomly select four characters (selecting the same character is allowed) from it. You are asked to calculate the probability of the four characters being ”avin” in order.
Input
The first line contains n (1 ≤ n ≤ 100), the length of the string. The second line contains the string. To simplify the problem, the characters of the string are from ’a’, ’v’, ’i’, ’n’.
Output
Print the reduced fraction (the greatest common divisor of the numerator and denominator is 1), representing the probability. If the answer is 0, you should output “0/1”.
Sample Input
4
avin
4
aaaa
Sample Output
1/256
0/1
很简单的概率问题,数学纯暴力
代码如下:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;string s;
int n;int gcd(int x,int y)
{if(y==0) return x;else return gcd(y,x%y);
}
int main()
{while(scanf("%d",&n)!=EOF){cin>>s;int cnt1=0;int cnt2=0;int cnt3=0;int cnt4=0;int len=s.length();for(int i=0;i<len;i++){if(s[i]=='a') cnt1++;else if(s[i]=='v') cnt2++;else if(s[i]=='i') cnt3++;else if(s[i]=='n') cnt4++;}len=len*len*len*len;int cnt=cnt1*cnt2*cnt3*cnt4;cnt1=gcd(cnt,len);printf("%d/%d\n",cnt/cnt1,len/cnt1);}
}

Traffic HDU - 6573
Avin is observing the cars at a crossroads. He finds that there are n cars running in the east-west direction with the i-th car passing the intersection at time ai . There are another m cars running in the north-south direction with the i-th car passing the intersection at time bi . If two cars passing the intersections at the same time, a traffic crash occurs. In order to achieve world peace and harmony, all the cars running in the north-south direction wait the same amount of integral time so that no two cars bump. You are asked the minimum waiting time.
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 1, 000). The second line contains n distinct integers ai (1 ≤ ai ≤ 1, 000). The third line contains m distinct integers bi (1 ≤ bi ≤ 1, 000).
Output
Print a non-negative integer denoting the minimum waiting time.
Sample Input
1 1
1
1
1 2
2
1 3
Sample Output
1
0
狗题,一开始读错题了,耽误了好久。rng
直接枚举等待的时间,让南北向的车都等待,去判断是否可行。
代码如下:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;const int maxx=5e3+100;
bool vis1[maxx];
bool vis2[maxx];
int a[maxx];
int b[maxx];
int n,m;int main()
{while(scanf("%d%d",&n,&m)!=EOF){memset(vis1,0,sizeof(vis1));memset(vis2,0,sizeof(vis2));for(int i=1;i<=n;i++) scanf("%d",&a[i]),vis1[a[i]]=1;for(int i=1;i<=m;i++) scanf("%d",&b[i]);for(int t=0;t<=3008;t++){memset(vis2,0,sizeof(vis2));for(int i=1;i<=m;i++){vis2[b[i]+t]=1;}int flag=0; for(int i=1;i<=t+100;i++){if(vis1[i]&&vis2[i]){flag=1;break;}}if(flag==0){printf("%d\n",t);break;}}}
}

Rng HDU - 6574
Avin is studying how to synthesize data. Given an integer n, he constructs an interval using the following method: he first generates a integer r between 1 and n (both inclusive) uniform-randomly, and then generates another integer l between 1 and r (both inclusive) uniform-randomly. The interval [l, r] is then constructed. Avin has constructed two intervals using the method above. He asks you what the probability that two intervals intersect is. You should print p* q(−1)(MOD 1, 000, 000, 007), while pq denoting the probability.
Input
Just one line contains the number n (1 ≤ n ≤ 1, 000, 000).
Output
Print the answer.
Sample Input
1
2
Sample Output
1
750000006
其实这个题就是瞎凑数。。。
写了一个求逆元的找出n=2的时候,是3/4。又自己手算了一遍n=3的时候是2/3也就是4/6。在我算n=4的时候,队友猜了一个结论交上去了就过了orz。
代码如下:

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
#include<functional>
#define mod 9973
using namespace std;
typedef long long ll;
char s[100000+10];
long long int sum[100000+10];
ll gcd(ll a,ll b,ll &x,ll &y)
{if(b==0){x=1;y=0;return a;}ll q=gcd(b,a%b,y,x);y-=a/b*x;return q;
}
ll cal(ll a,ll b,ll c)
{ll x,y;ll g=gcd(a,b,x,y);if(c%g!=0) return -1;x*=c/g;b/=g;if(b<0) b=-b;ll ans=x%b;if(ans<=0) ans+=b;return ans;
}
ll qsm(ll a,ll b,ll c)
{ll ans=1;ll res=a%c;while(b){if(b&1)ans*=res,ans%=c;res*=res;res%=c;b>>=1;}return ans%c;
}
int main ()
{ll n;while(cin>>n){cout<<((1+n)*cal(2ll*n,1000000007L,1L))%1000000007<<endl;}return 0;
}

Budget HDU - 6575
Avin’s company has many ongoing projects with different budgets. His company records the budgets using numbers rounded to 3 digits after the decimal place. However, the company is updating the system and all budgets will be rounded to 2 digits after the decimal place. For example, 1.004 will be rounded down
to 1.00 while 1.995 will be rounded up to 2.00. Avin wants to know the difference of the total budget caused by the update.
Input
The first line contains an integer n (1 ≤ n ≤ 1, 000). The second line contains n decimals, and the i-th decimal ai (0 ≤ ai ≤ 1e18) represents the budget of the i -th project. All decimals are rounded to 3 digits.
Output
Print the difference rounded to 3 digits…
Sample Input
1
1.001
1
0.999
2
1.001 0.999
Sample Output
-0.001
0.001
0.000
水题,但是还是错了一发,(读错题了rng)
代码如下:

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define ll long long
using namespace std;const int maxx=1e3+100;
string s;
int n;int main()
{while(scanf("%d",&n)!=EOF){double ans=0.0;int len;for(int i=1;i<=n;i++){cin>>s;len=s.length();if(s[len-1]=='0') continue;else if(s[len-1]>='5'&&s[len-1]<='9') ans+=0.001*(10-s[len-1]+'0');else if(s[len-1]<'5'&&s[len-1]>'0') ans-=0.001*(s[len-1]-'0');}printf("%.3lf\n",ans);}return 0;
}

Worker HDU - 6576
Avin meets a rich customer today. He will earn 1 million dollars if he can solve a hard problem. There are n warehouses and m workers. Any worker in the i-th warehouse can handle ai orders per day. The customer wonders whether there exists one worker assignment method satisfying that every warehouse handles the same number of orders every day. Note that each worker should be assigned to exactly one warehouse and no worker is lazy when working.
Input
The first line contains two integers n (1 ≤ n ≤ 1, 000), m (1 ≤ m ≤ 1018). The second line contains n integers. The i-th integer ai (1 ≤ ai ≤ 10) represents one worker in the i-th warehouse can handle ai orders per day.
Output
If there is a feasible assignment method, print “Yes” in the first line. Then, in the second line, print n integers with the i-th integer representing the number of workers assigned to the i-th warehouse.
Otherwise, print “No” in one line. If there are multiple solutions, any solution is accepted.
Sample Input
2 6
1 2
2 5
1 2
Sample Output
Yes
4 2
No
提议挺简单的,就是分配工人。但是一开始队友最小公倍数求错了。GG了。多个数的最小公倍数就是先求两个数的最小公倍数,然后再和第三个数求最小公倍数,依次下去。
代码如下:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;const int maxx=1e3+100;
ll a[maxx];
int n;
ll m;ll gcd(ll x,ll y)
{if(y==0) return x;else return gcd(y,x%y);
}
int main()
{while(scanf("%d%lld",&n,&m)!=EOF){for(int i=1;i<=n;i++) scanf("%lld",&a[i]);ll temp=a[1]*a[2]/gcd(a[1],a[2]);ll cgcd;for(int i=3;i<=n;i++){cgcd=gcd(temp,a[i]);temp=temp*a[i]/cgcd;}ll sum=0;for(int i=1;i<=n;i++) sum+=temp/a[i];if(sum>m||m%sum!=0){puts("No");continue;}puts("Yes");for(int i=1;i<=n;i++){printf("%lld",(temp/a[i])*(m/sum));if(i!=n) printf(" ");else printf("\n"); }}
}

Class HDU - 6577
Avin has two integers a, b (1 ≤ a, b ≤ 1, 000).
Given x = a + b and y = a - b, can you calculate ab?
Input
The first line contains two integers x, y.
Output
Print the result of a
b.
Sample Input
4 2
Sample Output
3
水的不能再水的解方程
代码如下:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;int main()
{int x,y;cin>>x>>y;cout<<(x+y)*(x-y)/4<<endl;}

A题的数据结构题没出出来。补完之后再发。
努力加油a啊,(o)/~

2019CCPC-江西省赛(重现赛)- 感谢南昌大学相关推荐

  1. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it

    链接:https://www.nowcoder.com/acm/contest/163/F 来源:牛客网 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it 时间限制:C ...

  2. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers

    传送门 题意:问你从[1,N]有多少个数能被自身的SOD(sum of digits)整除 题解:数位dp,枚举SOD,因为最多只有12位,所以只要枚举1到12*9,一维记录pos,二维记录当前剩余要 ...

  3. 河北省省赛重现赛-K Multiple Longest Commom Subsequence

    2017: K Multiple Longest Commom Subsequence 描述 题目描述: KK has two sequences, AAA and BBB, and wants to ...

  4. 2019CCPC江西省赛(重现赛)| 题目 题解

    2019CCPC江西省赛(重现赛)在hdu进行 据说很简单 因为现场有多个队伍AK 然鹅 我在40分钟内AC两题之后 就卡在概率题 (后来就没做题目emmm) 先放官方题解 然后慢慢补题 嗯! 题目: ...

  5. 2016ACM/ICPC亚洲区沈阳站-重现赛(感谢东北大学)

    目录 A Thickest Burger B Relative atomic mass C Recursive sequence · 矩阵快速幂 E Counting Cliques · 暴力 H G ...

  6. HDU 5127.Dogs' Candies-STL(vector)神奇的题,set过不了 (2014ACM/ICPC亚洲区广州站-重现赛(感谢华工和北大))...

    周六周末组队训练赛. Dogs' Candies Time Limit: 30000/30000 MS (Java/Others)    Memory Limit: 512000/512000 K ( ...

  7. 2017广西邀请赛重现赛

    总题解:http://www.nike0good.com/674.html 1001: 2017ACM/ICPC广西邀请赛-重现赛 1001 A Math Problem #include <i ...

  8. 北京信息科技大学第十三届程序设计竞赛暨ACM选拔赛(重现赛)题解

    题目链接: 北京信息科技大学第十三届程序设计竞赛暨ACM选拔赛(重现赛)_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ大学ACM校赛新生赛是面向ACM/ICPC/CCP ...

  9. 【数学建模】6 近十年江西省研究生建模赛题及近三年全国建模赛题目录

    1 数学建模的基本过程 (1)模型准备–了解背景 (2)模型假设–明确目标 (3)模型建立–刻画规律 (4)模型建立–得到结果 (5)模型分析–总结规律 (6)模型检验–形成结论 2 江西省研究生历年 ...

  10. 第 45 届国际大学生程序设计竞赛(ICPC)亚洲区域赛(济南)(重现赛)

    第 45 届国际大学生程序设计竞赛(ICPC)亚洲区域赛(济南)(重现赛) 导语 涉及的知识点 题目 C D G J M 参考文献 导语 日常的队内集训,开始的时候状态其实很好,但是到了后两题就出现了 ...

最新文章

  1. LINQPad学习与验证工具
  2. php 使用redis锁限制并发访问类
  3. Oracle其它数据库对象:视图、序列、同义词
  4. caffe学习笔记18-image1000test200数据集分类与检索完整过程
  5. 转:在RHEL5系统中搭建iSCSI存储服务器
  6. 【原创】C#中的抽象类(abstract class)和接口(interface)的比较
  7. 序列化与反序列化的单例模式_序列化代理模式
  8. leetcode275. H指数 II(二分法)
  9. 在 git hooks 中运行 npm script
  10. 正则 (?i,m,s,x,g)
  11. 【毕业答辩】学位论文答辩ppt指南!
  12. wifi rssi 计算 距离_SKYLAB:蓝牙室内定位与WiFi室内定位的对比分析
  13. ARM嵌入式系统开发之接收函数的实现
  14. 为什么每个邮件收到后都会有一个htm的附件_职场邮件:领导、同事都喜欢收到的邮件丨邮件技巧...
  15. ffmpeg给视频添加文字
  16. 什么是弹性(display: flex)布局 ?
  17. python数据库操作orm_python【第十二篇下】操作MySQL数据库以及ORM之 sqlalchemy
  18. 史上最详细的AVL树(含代码实现)
  19. 将你的 Python 脚本转换为命令行程序
  20. 期末计算机考试总结,计算机期末考试总结重点 吐血整理.doc

热门文章

  1. IOS15的抽屉效果
  2. linux动态库符号检查,写 Linux 动态库的最佳实践
  3. 浅谈Handler机制
  4. custompage.width 不能小数吗_基金净值暴涨暴跌,背后的原因你清楚吗?
  5. osgCallback的实现方法及原理
  6. java 传递intent_java – 如何将泛型类作为param传递给Intent构造函数
  7. iOS 证书、密钥及信任服务
  8. mysql大数据更新缓存_redis缓存mysql
  9. R语言对用电负荷时间序列数据进行K-medoids聚类建模和GAM回归
  10. Golang 推荐的命名规范