2016CCPC网预总结
暑假训练一个暑假,也迎来了ccpc网预。这大概是继校赛后的另一场大比赛吧。
比赛回顾
上来读第一题,发现是个简单取模,不超过10000000!这简直弱智啊!结果WA。仔细读题,tmd数字长度不超过10000000。。。胡乱翻高精度的板子,基本都用了string类。套了几个都是T。。。然后我开始搞java,结果内存限制。。。最后队友看不下去了,想了想,光取模不用那么复杂。。。手写了一个,直接ac。。我内心是崩溃的。。。
期间队友看了最后一题,这不是裸的最长上升子序列么~nlogn直接搞,又WA。。。改来改去,优化来优化去,就是过不了。。。队友写第一题,最后一题我就看了一下,发现映射关系不定,直接想到扫一遍,我写一发直接ac。。。内心再度崩溃。
然后看第四题发现a的比较多,果断搞一搞,队友贪心一发a。。
水题做完了,罚时。。。12小时。。。我真是b了狗了。然后和队友研究异或方程组,想了半天,最后不知道怎么靠到了异或方程组,也套了板子,不知为什么还是wa。期间特殊四面体和山的题都看了,都没什么思路。tmd我要知道四面体暴力就行我。。。
最后3题,弱鸡队伍平均水平。。要是罚时短一些,排名就能更好看一些了。tmd。。。
总结
比赛中都有水题,比如这次我们做出的这三道。我想无论什么级别的队伍,水题都要减小罚时,像我们这次一题提交13次。。。读题也是一个很严重的问题,最后一题最开始就是读题的锅。还有交代码前应该看看别的队伍的提交情况,没有java的就不要交java,代码长度,运行时间,都是参考信息。
再者就是算法了,掌握的算法、做的题还是不够多,这点就不必多说了。
认真读题!认真读题!认真读题!
代码
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <queue>
#include <cmath>
using namespace std;
const int maxn=105;
const long long INF=1e17;
typedef long long LL;
char s[10000010];
int main()
{
int t=1;
while(~scanf(" %s",s))
{
printf("Case #%d: ",t++);
if(strlen(s)<18)
{
long long sum=0;
for(int i=0;i<strlen(s);i++)
sum = sum*10+s[i]-'0';
if(sum%137==0 && sum%73==0)
printf("YES\n");
else
printf("NO\n");
}
else
{
int suma=0,sumb=0;
for(int i=0;i<strlen(s);i++)
{
suma = suma*10+s[i]-'0';
sumb = sumb*10+s[i]-'0';
if(suma>137) suma=suma%137;
if(sumb>73) sumb=sumb%73;
}
if(suma==0 && sumb==0)
printf("YES\n");
else
printf("NO\n");
}
}
}
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[15];
bool cmp(int x,int y)
{
return x>y;
}
int main()
{
int T,t=1;
scanf("%d",&T);
while(T--)
{
printf("Case #%d: ",t++);
int n,sum=0,temp=0,ans=0;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
sum/=2;
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;)
{
if(temp!=i && a[i])
{
ans++;
temp=i;
a[i]--;
sum--;
}
else
{
int flag=1;
for(int j=i+1;j<=n;j++)
{
if(a[j])
{
ans++;
temp=j;
a[j]--;
sum--;
flag=0;
break;
}
}
if(flag) break;
}
if(sum==0) break;
while(!a[i]) i++;
}
printf("%d\n",ans);
}
}
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <queue>
#include <cmath>
using namespace std;
const int MAXN=100007;
const int oo=1000000007;
typedef long long LL;
int a[MAXN];
char ch[MAXN];
int main() {
int T;
scanf("%d\n",&T);
for(int t=1;t<=T;t++)
{
int n=0;
memset(ch,0,sizeof(ch));
memset(a,0,sizeof(a));
gets(ch);
n=strlen(ch);
int res=0;
for(int i=0;i<n;i++)
{
int temp=ch[i]-'a';
if(a[temp]==0)
{
a[temp]=1;
res++;
}
}
printf("Case #%d: %d\n",t,res);
}
return 0;
}