OWenT's blog
  • Introduction
  • About Me
  • 2020
    • 近期对libatapp的一些优化调整(增加服务发现和连接管理,支持yaml等)
    • xresloader转表工具链增加了一些新功能(map,oneof支持,输出矩阵,基于模板引擎的加载代码生成等)
    • 在游戏服务器中使用分布式事务
    • libcopp接入C++20 Coroutine和一些过渡期的设计
    • libatbus 的大幅优化
    • nftables初体验
    • 容器配置开发环境小计
  • 2019
    • PALM Tree - 适合多核并发架构的B+树 - 论文阅读小记
    • 跨平台协程库 - libcopp 简介
    • C++20 Coroutine 性能测试 (附带和libcopp/libco/libgo/goroutine/linux ucontext对比)
    • 尝鲜Github Action
    • 一些xresloader(转表工具)的改进
    • protobuf、flatbuffer、msgpack 针对小数据包的简单对比
    • 协程框架(libcopp) 小幅优化
    • Excel转表工具(xresloader) 增加protobuf插件功能和集成 UnrealEngine 支持
    • Anna(支持任意扩展和超高性能的KV数据库系统)阅读笔记
    • C++20 Coroutine
    • libcopp merge boost.context 1.69.0
    • Google去中心化分布式系统论文三件套(Percolator、Spanner、F1)读后感
    • Rust玩具-企业微信机器人通用服务
  • 2018
    • 使用ELK辅助监控开发测试环境服务质量和问题定位
    • Webpack+vue+boostrap+ejs构建Web版GM工具
    • 2018年的新通用伪随机数算法(xoshiro / xoroshiro)的C++(head only)实现
    • Rust的第二次接触-写个小服务器程序
    • 理解和适配AEAD加密套件
    • atsf4g-co的进化:协程框架v2、对象路由系统和一些其他细节优化
    • 协程框架(libcopp)v2优化、自适应栈池和同类库的Benchmark对比
    • 可执行文件压缩
    • 初识Rust
    • 使用restructedtext编写xresloader文档
    • atframework的etcd模块化重构
    • C++的backtrace
  • 2017
    • ECDH椭圆双曲线(比DH快10倍的密钥交换)算法简介和封装
    • protobuf-net的动态Message实现
    • pbc的proto3接入
    • atgateway内置协议流程优化-加密、算法协商和ECDH
    • 整理一波软件源镜像同步工具+DevOps工具
    • Blog切换到Hugo
    • libcopp v2的第一波优化完成
    • libcopp(v2) vs goroutine性能测试
    • libcopp的线程安全、栈池和merge boost.context 1.64.0
    • GCC 7和LLVM+Clang+libc++abi 4.0的构建脚本
    • libatbus的几个藏得很深的bug
    • 用cmake交叉编译到iOS和Android
    • 开源项目得一些小维护
    • atapp的c binding和c#适配
    • 对象路由系统设计
    • 2016年总结
    • 近期的一个协程流程BUG
  • 2016
    • 重写了llvm+clang+libc++和libc++abi的构建脚本
    • atsf4g完整游戏工程示例
    • atframework基本框架已经完成
    • 游戏服务器的不停服更新
    • 对atbus的小数据包的优化
    • Android和IOS的TLS问题
    • pbc的一个陈年老BUG
    • boost.context-1.61版本的设计模型变化
    • 接入letsencrypt+全面启用HTTP/2
    • 理解Raft算法
    • libatbus基本功能及单元测试终于写完啦
    • 博客文章和文档迁移到gitbook
  • 2015
    • 博客文章和文档迁移到gitbook
    • 给客户端写得LRU缓存
    • 近期活动比较零散
    • 关于BUS通信系统的一些思考(三)
    • 针对Java JIT的优化(转表工具:xresloader)
    • libcopp更新 (merge boost 1.59 context)
    • 小记最近踩得两个C++坑
    • Redis全异步(HA)Driver设计稿
    • Vim常用命令
    • 关于firewalld和systemd的一些命令速记
    • Jenkins(hudson)插件记录
    • 我们的Lua类绑定机制
    • LLVM+Clang+Libcxx+Libcxxabi(3.6)工具链编译(完成自举编译)
    • 回顾2014
    • Android NDK undefined reference to ___tls_get_addr 错误
    • gitlab腾讯企业邮箱配置
  • 2014
    • 回顾2013
    • C++11动态模板参数和type_traits
    • C++又一坑:动态链接库中的全局变量
    • tolua++内存释放坑
    • [转]类似github的框架
    • Lua性能分析
    • 集成Qt Webkit 到cocos2d-x
    • Gitlab环境搭建小计
    • 近期研究VPN的一些记录(OpenVPN,pptp,l2tp)
    • LLVM + Clang + Libcxx + Libcxxabi 工具链编译
    • 关于BUS通信系统的一些思考(二)
    • 关于BUS通信系统的一些思考(一)
    • [libiniloader] Project
    • 记录一些在线编辑器
    • [WP Code Highlight.js] Project
    • 再议 C++ 11 Lambda表达式
    • 基于Chrome插件的开发工具链
    • [ACM] HDU 1006 解题报告
    • Linux 编译安装 GCC 4.9
    • 又碰到了这个解谜游戏,顺带记下地址
    • 简单C++单元测试框架(支持一键切到GTest或Boost.Test)
    • 捣鼓一个协程库
  • 2013
    • std和boost的function与bind实现剖析
    • 不知道是哪一年的腾讯马拉松题目 照片评级 解题报告
    • Lua 挺好用的样子
    • VC和GCC成员函数指针实现的研究(三)
    • VC和GCC成员函数指针实现的研究(二)
    • VC和GCC内成员函数指针实现的研究(一)
    • 一个C++关于成员变量偏移地址的小Trick
    • ptmalloc,tcmalloc和jemalloc内存分配策略研究
    • POJ 2192 Zipper HDU 2059 龟兔赛跑
    • 从Javascript到Typescript到Node.js
    • 网络编程小结
    • 试试Boost.Asio
    • Lnmp yum 安装脚本 (for CentOS)
    • ARM 交叉编译环境搭建
    • Linux 编译安装 GCC 4.8
    • [记录]虚拟硬盘的压缩|磁盘写零
  • 2012
    • Boost.Spirit 初体验
    • “C++的90个坑”-阅读笔记
    • AC自动机
    • C++ 标准过渡期
    • 程序员修炼之道 -- 阅读笔记
    • [转载]狼与哈士奇
    • C++ 新特性学习(八) — 原子操作和多线程库[多工内存模型]
    • C++ 新特性学习(七) — 右值引用
    • 理解Protobuf的数据编码规则
    • 忆往昔ECUST的ACM时代
    • Linux编译安装GCC 4.7
    • JSON显示库 -- showJson (Javascript)
    • C++ 新特性学习(六) — 新的字符串编码和伪随机数
    • C++ 新特性学习(五) — 引用包装、元编程的类型属性和计算函数对象返回类型
    • C++ 新特性学习(四) — Bind和Function
  • 2011
    • C++ 新特性学习(三) — Regex库
    • C++ 新特性学习(二) -- Array、Tuple和Hash库
    • C++ 新特性学习(一) -- 概述+智能指针(smart_ptr)
    • Linux 和 Windows PowerShell 常用工具/命令 记录
    • 非常帅气的Linq to sql
    • 2011 Google Code Jam 小记
    • C++总是很神奇
    • 大学生创新项目[国家级]经费使用记录
    • 常用官方文档整理
    • 我们学校的IPV6很不错嘛
  • 2010
    • 线段树相关问题 (引用 PKU POJ题目) 整理
    • 2010 ACM 赛前笔记
    • POJ PKU 2596 Dice Stacking 解题报告
    • POJ PKU 3631 Cuckoo Hashing 解题报告
    • POJ PKU 1065 Wooden Sticks 3636 Nested Dolls 解题报告
    • HDU 3336 Count the string 解题报告
    • Hash模板 个人模板
    • ZOJ 3309 Search New Posts 解题报告
    • POJ PKU Let's Go to the Movies 解题报告
    • 注册表常用键值意义
    • PKU POJ 1724 ROADS 解题报告
    • 《神奇古今秘方集锦》&《民间秘术大全》
    • PKU POJ 1720 SQUARES 解题报告
    • POJ PKU 2155 Matrix 解题报告
    • PKU POJ 1141 Brackets Sequence 解题报告
    • PKU POJ 2728 Desert King 解题报告
    • PKU POJ 2976 Dropping tests 解题报告
    • PKU POJ 3757 Simple Distributed storage system 解题报告
    • GCD Determinant 解题报告
    • Southeastern European 2008 Sky Code 解题报告
    • HDU HDOJ 3400 Line belt 解题报告
    • 线性筛法求质数(素数)表 及其原理
    • HDU HDOJ 3398 String 解题报告
    • 树状数组模块(个人模板)
    • 浙江理工 省赛总结 team62 By OWenT of Coeus
    • POJ PKU 3659 Cell Phone Network 解题报告
    • USACO 2008 March Gold Cow Jogging 解题报告
    • C#格式化输出(记录)
    • 参加有道难题笔记
    • POJ PKU 2446 Chessboard 解题报告
    • POJ PKU 1986 Distance Queries 解题报告
    • 计算几何算法概览[转载]
    • 关于差分约束(转载)
    • POJ PKU 2826 An Easy Problem?! 解题报告
    • 数论模板(个人模板)
    • 简易四则运算(ACM个人模板)
    • Catalan 数
    • The 35th ACM/ICPC Asia Regional Tianjin Site —— Online Contest 1009 Convex 解题报告
    • JQuery扩展插件--提示信息
    • ACM 计算几何 个人模板
    • 解析网站字符串型参数 Javascript QueryString 操作 TQueryString类
    • POJ PKU 1474 Video Surveillance 解题报告
  • 2009
    • 模式匹配(kmp)个人模板
    • 并查集 模板
    • POJ 3267 The Cow Lexicon 解题报告
    • C/C++语言常用排序算法
    • POJ 2606 Rabbit hunt 2780 Linearity 1118 Lining Up 解题报告
    • 打造最快的Hash表(转) [以暴雪的游戏的Hash为例]
    • ECUST 09年 校赛个人赛第六,七场总结
    • ECUST 09年 校赛个人赛第三场部分解题报告(A,D,F,I)
    • 牛顿迭代解方程 ax^3+bX^2+cx+d=0
    • 09年8月9日 ECUST ACM 练习赛总结
    • 连接最多点直线 (OWenT 个人模板)
    • 点到直线距离 和 线段间最短距离 (OWenT 模板)
    • ECUST 09年 校赛个人训练赛第五场总结
    • ECUST 09年 校赛个人赛第八场(最后一场)总结
    • 09年8月14日 ECUST ACM 练习赛总结
    • 矩阵相关 (增强中)
    • Prime最小生成树(个人模板)
    • 最长单调子序列 复杂度nlog(n)
    • POJ PKU 2549 Sumsets 解题报告
    • POJ PKU 3277 City Horizon 解题报告
    • 我的ACM生涯
    • POJ PKU 2528 Mayor's posters 解题报告
    • POJ PKU 2378 Tree Cutting 解题报告
    • POJ PKU 1990 MooFest 解题报告
Powered by GitBook
On this page
  • A Grey Area
  • B Expected Allowance
  • 第七场
  • B要注意一下判断的优先级.
  • E Stock Exchange
  • C题很烦,但是我觉得可以通过列出各种特殊情况出来死套。太烦了所以没写
  • D题我觉得可以通过DP+Hash来完成,按最长子序列的反向DP(不过我觉得等我想出来DP方案时间也到了,就没写)
  • F题我没什么思路
  • G题我认为可以DP,主要是算出三个子段的最小值,且三个子段的长度和为k-1,但是DP的话要写24种分支,我觉得这个方法并不好,所以也没写

Was this helpful?

  1. 2009

ECUST 09年 校赛个人赛第六,七场总结

校赛个人赛第六,七场总结

这两场比赛体现了英文水平的重要性

第六场的题目超长,用词还诡异,话了很长时间才看懂

这两场题目都比较有难度,第六场我只出了2题

A Grey Area

A题是很诡异的统计,是一道纯模拟就能过的题,其他的不多说了

代码:

#include<iostream>
using namespace std;
int pe[20];
int main()
{
    int n,w;
    while(cin>>n>>w, n || w)
    {
        int value;
        int peNum = 0;
        int Max = 0;
        int valueMax = 0;
        memset(pe,0,sizeof(pe));
        while(n --)
        {
            scanf("%d",&value);
            while(value >= Max)
            {
                peNum ++;
                Max = peNum * w;
            }
            pe[value / w] ++;
            if(pe[value / w] > valueMax)
                valueMax = pe[value / w];
        }

        double output = 0.01;
        for(int i = 0 ; i < peNum ; i ++)
            output += ((double)pe[i] / (double)valueMax)
                * ((double)(peNum - i - 1) / (double)(peNum - 1));

        printf("%lf\n",output);
    }
    return 0;
}

B Expected Allowance

B题和A题类似,也是纯暴力

代码:

#include<iostream>
#include<cmath>
using namespace std;
long value[10000];

void cal(long now,int pos,int n,int m)
{
    for(int i = 1 ; i <= m ; i ++)
        if(pos == n)
            value[now + i] ++;
        else
            cal(now + i,pos + 1,n,m);
}


int main()
{
    long m,n,k;
    while(scanf("%ld %ld %ld",&n,&m,&k), n || m || k )
    {
        memset(value,0,sizeof(value));
        cal(0,1,n,m);
        double output = 0.0;
        double fm = pow((double)m,(double)n);
        for(long i = n ; i <= n * m ; i ++)
            if(i - k <= 0)
                output += (double)value[i] / fm;
            else
                output += (double)value[i] / fm * (double)(i - k);

        printf("%.8lf\n",output);
    }
    return 0;
}

第七场

第七场很多题目都有想法,可是很多都没能写出来

同样B和E是水题,直接暴力能过,不过就是要有耐性

B要注意一下判断的优先级.

代码如下:

#include<iostream>
#include<cstring>
using namespace std;
double bank[10][10000];
char cmd[20];
int isExist[10][10000];
int main()
{
    int n = 1;
    //freopen("b.in","r",stdin);
    while(scanf("%d",&n),n)
    {
        memset(bank,0,sizeof(bank));
        memset(isExist,0,sizeof(isExist));
        while(n --)
        {
            int tmpInt1,tmpInt2;
            double tmpMoney;
            scanf("%d/%d %lf",&tmpInt1,&tmpInt2,&tmpMoney);
            isExist[tmpInt2][tmpInt1] = 1;
            bank[tmpInt2][tmpInt1] = tmpMoney;
        }
        while(scanf("%s",cmd) , strcmp(cmd,"end"))
        {
            if(!strcmp(cmd,"withdraw"))
            {
                int tmpInt1,tmpInt2;
                double tmpMoney;
                scanf("%d/%d %lf",&tmpInt1,&tmpInt2,&tmpMoney);
                printf("withdraw %.2lf: ",tmpMoney);
                if(isExist[tmpInt2][tmpInt1])
                {
                    if(bank[tmpInt2][tmpInt1] < tmpMoney)
                        printf("insufficient funds\n");
                    else
                    {
                        printf("ok\n");
                        bank[tmpInt2][tmpInt1] -= tmpMoney;
                    }
                }
                else
                    printf("no such account\n");
            }
            else if(!strcmp(cmd,"deposit"))
            {
                int tmpInt1,tmpInt2;
                double tmpMoney;
                scanf("%d/%d %lf",&tmpInt1,&tmpInt2,&tmpMoney);
                printf("deposit %.2lf: ",tmpMoney);
                if(isExist[tmpInt2][tmpInt1])
                {
                    printf("ok\n");
                    bank[tmpInt2][tmpInt1] += tmpMoney;
                }
                else
                    printf("no such account\n");
            }
            else if(!strcmp(cmd,"create"))
            {
                int tmpInt1,tmpInt2;
                scanf("%d/%d",&tmpInt1,&tmpInt2);
                printf("create: ");
                if(isExist[tmpInt2][tmpInt1])
                    printf("already exists\n");
                else
                {
                    printf("ok\n");
                    isExist[tmpInt2][tmpInt1] = 1;
                    bank[tmpInt2][tmpInt1] = 0;
                }
            }
            else if(!strcmp(cmd,"transfer"))
            {
                int tmpInt1,tmpInt2,tmpInt3,tmpInt4;
                double tmpMoney;
                scanf("%d/%d %d/%d %lf",&tmpInt1,&tmpInt2,&tmpInt3,&tmpInt4,&tmpMoney);
                printf("transfer %.2lf: ",tmpMoney);
                if(isExist[tmpInt2][tmpInt1] && isExist[tmpInt4][tmpInt3])
                {
                    if(tmpInt2 == tmpInt4 && tmpInt1 == tmpInt3)
                        printf("same account\n");
                    else if(bank[tmpInt2][tmpInt1] < tmpMoney)
                        printf("insufficient funds\n");
                    else
                    {
                        if(tmpInt2 == tmpInt4)
                            printf("ok\n");
                        else
                            printf("interbank\n");
                        bank[tmpInt2][tmpInt1] -= tmpMoney;
                        bank[tmpInt4][tmpInt3] += tmpMoney;
                    }
                }
                else
                    printf("no such account\n");
            }
        }
        printf("end\n\n");
    }
    printf("goodbye");
    return 0;
}

E Stock Exchange

我这题TLE一次,原因是很郁闷的忘了把freopen函数给注释掉 -_-!!

我的代码如下:

#include<iostream>
#include<cstring>
using namespace std;
char Issuer[12];
struct Member
{
    char name[30];
    double money;
    char type[10];
};
Member mem[1001];
int main()
{
    int n;
    //freopen("e.txt","r",stdin);
    while(scanf("%d %s",&n,Issuer), strcmp(Issuer,"END") || n)
    {
        int i,j;
        for(i = 0 ; i < n ; i ++)
            scanf("%s %s %lf",mem[i].name,mem[i].type,&mem[i].money);

        printf("%s\n",Issuer);
        int num = 0;
        for(i = 0 ; i < n ; i ++)
        {
            num = 0;
            printf("%s:",mem[i].name);
            for(j = 0 ; j < n ; j ++)
            {
                if(mem[i].type[0] == mem[j].type[0])
                    continue;
                if(mem[i].type[0] == 'b'
                    && mem[j].money <= mem[i].money)
                    printf(" %s",mem[j].name),num ++;
                else if(mem[i].type[0] == 's'
                    && mem[j].money >= mem[i].money)
                    printf(" %s",mem[j].name),num ++;
            }
            if(num)
                putchar('\n');
            else
                printf(" NO-ONE\n");
        }
    }
    return 0;
}

C题很烦,但是我觉得可以通过列出各种特殊情况出来死套。太烦了所以没写

D题我觉得可以通过DP+Hash来完成,按最长子序列的反向DP(不过我觉得等我想出来DP方案时间也到了,就没写)

F题我没什么思路

G题我认为可以DP,主要是算出三个子段的最小值,且三个子段的长度和为k-1,但是DP的话要写24种分支,我觉得这个方法并不好,所以也没写

以上各题希望大牛能分享思路,指点一二。

Previous打造最快的Hash表(转) [以暴雪的游戏的Hash为例]NextECUST 09年 校赛个人赛第三场部分解题报告(A,D,F,I)

Last updated 6 years ago

Was this helpful?