↓ Skip to main content

Posts

2017

快速乘

·234 words·1 min
16年北京网络赛遇到了这个技巧…但是竟然忘记记了下来? 快速乘是为了解决 计算a_b % mod 时a_b溢出LL 的问题 比如a=1E16,b=1E16,mod=1E18,虽然最后的结果没有溢出,但是中间溢出了。

20170929

·359 words·1 min
刚刚看了TBBT season 11 episode 1 Sheldon 和Amy 订婚了,Bernadette又怀孕了。 想想上一季结束的时候,大概半年前。 我好像还是只单身狗,手头没啥能看的offer,还有巨大的学业压力在前方。

zoj 3606 Lazy Salesgirl (线段树,单点更新,区间合并)

·1160 words·3 mins
zoj3606题目链接 题意:有个小女孩卖火柴,有n个人会来买,分别在时间t[i],以价格p[i],买的火柴个数为1+(k-1)%3,其中k为这是小女孩第几次卖火柴。 如果有大于w的时间没人来买火柴,小女孩就会睡着。小女孩睡着后如果有人来买火柴,那小女孩就会醒过来,但是不会卖给这个人火柴。现在问使营业额最大的基础上最小的时间间隔w。

codeforces edu #29 E. Turn Off The TV (思维,乱搞)

·737 words·2 mins
题目链接 题意:有若干线段,给出起点和终点,问是否有一个线段是冗余的。冗余的意思是说,对于该线段所覆盖的所有整数点,没有该线段,也能被其他一个或者多个线段覆盖到。如果有,输出任意一个冗余线段即可。

Codeforces eductional round 29

·2705 words·6 mins
比赛链接 10个月没写题了,菜啊。进行一点恢复性训练好了。 A: 给一个数,可以在填写若干(或者0)个前缀0,问能否变成回文数。 思路是直接删掉后面可能的出现的0再判断回文数就好。 代码实现 1/* *********************************************** 2Author :111qqz 3Created Time :2017年09月24日 星期日 13时51分06秒 4File Name :A.cpp 5************************************************ */ 6 7#include <cstdio> 8#include <cstring> 9#include <iostream> 10#include <algorithm> 11#include <vector> 12#include <queue> 13#include <set> 14#include <map> 15#include <string> 16#include <cmath> 17#include <cstdlib> 18#include <ctime> 19#define PB push_back 20#define fst first 21#define sec second 22#define lson l,m,rt<<1 23#define rson m+1,r,rt<<1|1 24#define ms(a,x) memset(a,x,sizeof(a)) 25typedef long long LL; 26#define pi pair < int ,int > 27#define MP make_pair 28 29using namespace std; 30const double eps = 1E-8; 31const int dx4[4]={1,0,0,-1}; 32const int dy4[4]={0,-1,1,0}; 33const int inf = 0x3f3f3f3f; 34bool check( int x) 35{ 36 vector<int>val; 37 while (x) 38 { 39 int tmp = x; 40 val.push_back(tmp); 41 x/=10; 42 } 43 int siz = val.size(); 44 if (siz==1) return true; 45 for ( int i = 0 ; i < siz/2 ; i++) 46 { 47 if (val[i]!=val[siz-1-i]) return false; 48 } 49 return true; 50} 51int main() 52{ 53 #ifndef ONLINE_JUDGE 54 //freopen("./in.txt","r",stdin); 55 #endif 56 int x; 57 cin>>x; 58 while(x==0) 59 { 60 x/=10; 61 } 62 if (check(x)) puts("YES"); 63 else puts("NO"); 64 65 66 #ifndef ONLINE_JUDGE 67 fclose(stdin); 68 #endif 69 return 0; 70} B: 2*n个人,每个人的重量为w[i],要分成n-1组,每组2个人,以及2个单独的人。单独的人的不稳定性为0,每组的不稳定是该组的2个人的重量的差的绝对值。总的不稳定为所有组的不稳定性之和。问可能的最小不稳定性是多少。

反向传播学习笔记

·214 words·1 min
先说下自己目前很笼统的理解: 反向传播是用来快速计算梯度的一种方法; 过程大概是把计算过程用计算图表示,这样每一个中间步骤都有一个节点,每一个local gradient都会比较容易计算;

MPI 学习笔记

·592 words·2 mins
参考资料: 消息传递接口(MPI)维基百科 MPI_TUTORIAL MPI 在大规模机器学习领域的前景如何? 因为要和平台组对接工作以及写我们自己的BN同步…所以来了解一下MPI相关…感谢平台组@gyz 菊苣提供指导。

tensorflow input pipline 学习笔记

·2065 words·5 mins
参考资料: tf_doc_Reading data TENSORFLOW INPUT PIPELINE EXAMPLE tensorflow:理解tensorflow中的输入管道 第二个参考资料是第一个的翻译版本,翻译的水平一般,建议看原文,不是很长。 下面是我挑了文章中重点的部分+自己的理解。 TL;DR; # 一个适用于不是很大的数据集的pipeline input 的例子。

tensorflow 合并模型

·1696 words·4 mins
在这里存个备份,还有些问题没有解决。 raise ValueError(“GraphDef cannot be larger than 2GB.”) 记录一些思路好了。现在是没有生成.meta文件,爆掉应该是因为所有的变量都加载到了默认图里。 也就是说我处理完checkpoint 0 之后开始处理checkpoint1,但是checkpoint0的那些变量还是存在的…所以越来越多?

tensorflow checkpoint 学习笔记

·513 words·2 mins
参考资料: What is the TensorFlow checkpoint meta file? TensorFlow: Restoring variables from from multiple checkpoints 合并模型的时候发现.meta一直在累加,而其他数据文件没有改变。因此来探究一下checkpoint的几个文件的含义。 This file contains a serialized MetaGraphDef protocol buffer. The MetaGraphDef is designed as a serialization format that includes all of the information required to restore a training or inference process (including the GraphDef that describes the dataflow, and additional annotations that describe the variables, input pipelines, and other relevant information). For example, the MetaGraphDef is used by TensorFlow Serving to start an inference service based on your trained model. We are investigating other tools that could use the MetaGraphDef for training.

tensorflow variable 学习笔记

·3204 words·7 mins
参考资料: programmers_guide/variables tf/Variable 之前感觉对tensorflow 的variable的理解不是很深刻…跑个模型啥的倒不会有什么问题,但是涉及分布式,模型并行之类的,感觉有些地方还是要理解得仔细一点比较好。