• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Eric.cpp
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

随笔分类 -  优化技巧

 
Codeforces Beta Round #97 (Div. 2)
摘要:生气,比赛时就做出两道。A题,手速题,数组从属关系。B题,手速题,模拟三进制。C题,手速题,但我感觉明明就是阅读题,读明白了就能瞬秒,英语拙疾。1.what minimum number could occupy it after the replacement and the sorting.2.Printnspace-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.这两句鸟语下午饿着肚子硬读了好 阅读全文
posted @ 2012-08-13 00:06 Eric.cpp 阅读(247) 评论(0) 推荐(0)
Codeforces Round #107 (Div. 1) 某字符串任何子串都为回文串
摘要:Any its substring with length equal tokis a palindrome.对于一个长度为n的串,任何它的长度为k的字串都是回文串。该串具有这样的性质:如果k为偶数,母串所有字符都相等;aaaaaa如果k为奇数,母串最多由两种字母组成;abababaView Code #include <iostream>#include <math.h>#define MOD 1000000007using namespace std;long long ppow(long long x,long long y){ long long res=1; 阅读全文
posted @ 2012-08-11 02:54 Eric.cpp 阅读(332) 评论(0) 推荐(0)
Codeforces Round #100 总结 (pi=acos(-1.0)!!!cos(d),d为弧度!!!)
摘要:就做出了一道题,当初一道都做不出的我是不是脑残?偶然发现,第100场时,大家都那么水,看来所谓的蓝紫都是上学期练出来的。#include <iostream>#include <stdio.h>#include <math.h>#define pi acos(-1.0)using namespace std;int main(){ double n,R,r; while(cin >> n >> R >>r){ if(n==1 || n==2){ if(R>=r*n) cout <<"YES&qu 阅读全文
posted @ 2012-08-10 01:09 Eric.cpp 阅读(1650) 评论(0) 推荐(0)
hdu-4355(三分求极值)
摘要:打表发现题中函数满足凸函数性质,于是三分。View Code #include <iostream>#include <math.h>#include <stdio.h>#define eps 1e-9using namespace std;int n;struct P{ double x,w;}p[50005];double Calc(double i){ double S=0.0; for(int j=0;j<n;j++){ S+=fabs((i-p[j].x)*(i-p[j].x)*(i-p[j].x))*p[j].w; } return S;. 阅读全文
posted @ 2012-08-09 17:55 Eric.cpp 阅读(272) 评论(0) 推荐(0)
2012 Multi-University Training Contest 6
摘要:我就做了个1006啊!!!签到题啊!!!三分模板题啊!!!因为用cin输入而不用scanf一顿TLE啊!!!现学现卖,三分求凸函数极值。打表发现该函数符合凸函数性质,于是三分。View Code #include <iostream>#include <math.h>#include <stdio.h>#define eps 1e-9using namespace std;int n;struct P{ double x,w;}p[50005];double Calc(double i){ double S=0.0; for(int j=0;j<n;j 阅读全文
posted @ 2012-08-09 17:53 Eric.cpp 阅读(206) 评论(0) 推荐(0)
Codeforces Round #116 (Div. 2, ACM-ICPC Rules)
摘要:C题:思路清晰题,有点贪心的感觉。View Code #include <iostream>#include <string.h>using namespace std;int main(){ char s[100005]; while(cin >> s){ int len=strlen(s); int cous=0,coul=0; int minc=100005; for(int i=0;i<len;i++){ if(s[i]>='a' && s[i]<='z') cous++; ... 阅读全文
posted @ 2012-08-09 03:53 Eric.cpp 阅读(216) 评论(0) 推荐(0)
Codeforces Round #113 (Div. 2) (pow的时间复杂度是O(n))
摘要:A题:手速题,排序C题:思维清晰题,分类讨论E题:思维清晰题,找规律,(pow的时间复杂度是O(n)!!!)#include <iostream>#include <math.h>#include <stdio.h>using namespace std;long long a[10000005];int main(){ a[1]=0; a[2]=3; a[3]=6; a[4]=21; /*for(int i=5;i<=1000;i++){ //a[i]=((int)pow(3.0,double(i-1))-a[i-1])%1000000007; .. 阅读全文
posted @ 2012-08-08 17:26 Eric.cpp 阅读(643) 评论(0) 推荐(0)
Codeforces Round #102 (Div. 2)总结(如何处理A*B*C==n!!!)
摘要:A题:手速题B题:分类讨论题C题:暴力+优化的数学题#include <iostream>#include <math.h>using namespace std;int main(){ long long n; while(cin >> n){ unsigned long long maxc=0,minc=1844674407370955161; for(long long i=1;i*i<=n;i++){ if(n%i==0){ long long bc=n/i; fo... 阅读全文
posted @ 2012-08-08 17:13 Eric.cpp 阅读(339) 评论(0) 推荐(0)
Codeforces Round #112 (Div. 2) & #125 (Div. 2)总结(不要用pow&log!!!)
摘要:1.遇到需要用大数处理的问题,一定要先去思考能避开大数的程序,不要上来就用c++大数模板或java大数函数,前者敲起来繁琐,后者效率太低。#include <stdio.h>#include <iostream>using namespace std;int main(){ long long k,b,n,t,z; while(cin >> k >> b >> n >>t){ long long x=1; int cou=0; while(x<=t && cou<=n){ x=k*x+b; co 阅读全文
posted @ 2012-08-05 23:59 Eric.cpp 阅读(335) 评论(0) 推荐(0)
Codeforces Round #118 (Div. 2) B题(Codeforces上不支持qsort,只支持sort!!!)
摘要:一道裸的排序题,本应该瞬秒的,结果一直WA在第十组数据上,我很确信我的程序是对的,但就是WA。后来看了别人的代码,原来错在了qsort与sort的使用上!大家看一下我WA了8次的代码:#include <iostream>#include <stdio.h>#include <stdlib.h>using namespace std;struct P{ int num; double h;}p[10005];int cmp( const void *a , const void *b ){ struct P *c = (struct P *)a; struc 阅读全文
posted @ 2012-08-04 21:24 Eric.cpp 阅读(378) 评论(1) 推荐(0)
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3