5.2
手写堆
洛谷p3378
1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <algorithm> 5 using namespace std; 6 const int maxn = 2e6 + 5; 7 8 int heap[maxn],heap_size,n; 9 10 void put(int x) 11 { 12 int now,nxt; 13 heap[++heap_size] = x; 14 now = heap_size; 15 while (now > 1) 16 { 17 nxt = now >> 1; 18 if (heap[now] >= heap[nxt]) return; 19 swap(heap[now],heap[nxt]); 20 now = nxt; 21 } 22 } 23 24 void del() 25 { 26 int now,nxt,res = heap[1]; 27 heap[1] = heap[heap_size];heap_size--; 28 now = 1; 29 while (now*2 <= heap_size) 30 { 31 nxt = now * 2; 32 if (nxt <= heap_size && heap[nxt + 1] < heap[nxt]) nxt++; 33 if (heap[now] <= heap[nxt]) return; 34 swap(heap[now],heap[nxt]); 35 now = nxt; 36 } 37 return; 38 } 39 40 int get() {return heap[1];} 41 42 int main() 43 { 44 scanf("%d",&n); 45 int cmd,x; 46 heap_size = 0; 47 for (int i = 1;i <= n;i++) 48 { 49 scanf("%d",&cmd); 50 if (cmd == 1) 51 { 52 scanf("%d",&x); 53 put(x); 54 } 55 else if (cmd == 2) printf ("%d\n",get()); 56 else del(); 57 } 58 return 0; 59 }
5.3
生活轨迹发生了变化qaqaq
5.4
又要凉了... 没有准备的凉好像总是比有准备的凉更难受一些 qaqaq
-------- 昏割线 -----
好的,面挂的锅甩给楼下肯德基捉急的wifi了
5.5
立夏咯
py处理dicom,简单的读入显示.. 发现python显示出来的图自带一点彩色效果,比matlab的好看qwq
1 import numpy as np 2 import pdb 3 import dicom 4 import os 5 import scipy.ndimage 6 import pylab 7 from skimage import measure 8 9 dcm = dicom.read_file('test.dcm') 10 print (dcm.dir("pat")) 11 12 data_element = dcm.data_element("PatientsName") 13 print (data_element.VR,data_element.value) 14 15 pixel_bytes = dcm.PixelData 16 17 pix = dcm.pixel_array 18 print (pix) 19 20 pylab.imshow(dcm.pixel_array,cmap = pylab.cm.bone) 21 pylab.show()
5.6
EM算法 看不懂数学qaqqaqaq
5.7
5.8
处理过程中要用到求凸包...qaqaq原来这个也有现成的