void proc_ctrl() { #ifdef FOR_PSP static int counter = 0; if(++counter % 4 == 0) { sceCtrlReadBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_CROSS) { shiftdown(); } if(pad.Buttons & PSP_CTRL_SQUARE) shiftup(); if(pad.Buttons & PSP_CTRL_LEFT) moveleft(); if(pad.Buttons & PSP_CTRL_RIGHT) moveright(); if(pad.Buttons & PSP_CTRL_DOWN) movedown(); if(pad.Buttons & PSP_CTRL_LTRIGGER) rquad -= 0.5f; if(pad.Buttons & PSP_CTRL_RTRIGGER) rquad += 0.5f; if(pad.Buttons & PSP_CTRL_CIRCLE) r_quad += 0.5f; if(pad.Buttons & PSP_CTRL_TRIANGLE) r_quad -= 0.5f; } #endif }
void Dijkstra() { int i,mn,t; for(i=1;i<=n;i++) { dist[i]=maxw; p[i]=lc[i]=i; } dist[vs]=0; p[0]=n; buildheap(p,CFun); while(p[0]>0) { mn=extract(p,CFun); i=first[mn]; while(i!=-1) { if(dist[g[i].y]>dist[mn]+g[i].w) { dist[g[i].y]=dist[mn]+g[i].w; shiftup(p,lc[g[i].y],CFun); } i=g[i].next; } } }
method(MCHeap, size_t, insertValue, MCGeneric newval) { MCHeap* heap = obj; heap->values[++heap->count] = newval; shiftup(heap, heap->count); return 0; }
void * minheap_pop(minheap_t *heap) { void * root; if (heap->len == 0) return NULL; heap->swp(array_at(heap->array, 0), array_at(heap->array, heap->len-1)); heap->len--; shiftup(heap, 0); root = array_at(heap->array, heap->len); /* note the previous first elm has been swapped to here. */ return root; }
void heapdel(int *heap,int i,int (*CFun)(int,int)) { lc[heap[i]]=-1; if(--heap[0]>=i) { heap[i]=heap[heap[0]+1]; lc[heap[i]]=i; heapify(i); shiftup(i); } }
int main() { int i,n,t1,t2; printf("enter the number of jobs: "); scanf("%d",&n); int a[n][3]; for(i=0;i<n;i++) { printf("enter the arrival time of job %d: ",i+1); scanf("%d",&a[i][0]); printf("enter the required time of job %d: ",i+1); scanf("%d",&a[i][1]); a[i][2]=i+1; shiftup(a,i); } for(i=0;i<n;i++) { printf("%d %d %d \n",a[i][0],a[i][1],a[i][2]); } int count=0; rearrange(a,n); while(a[0][1]!=0) { t1=a[0][1]; for(i=1;i<n;i++) { if(a[i][0]>T) break; } if(i<n && (a[i][0]-T)<t1) t1 =a[i][0]-T; a[0][1] -=t1; T=T+t1; if(a[0][1]==0) { printf("job %d completed at %d seconds \n",a[0][2],T); a[0][1]=a[n-1][1]; a[0][0]=a[n-1][0]; a[0][2]=a[n-1][2]; n=n-1; } rearrange(a,n); } return 0; }
void keydown(unsigned char key, int x, int y) { #ifndef FOR_PSP switch(key) { case 27: { // glutDestroyWindow(wnd); exit(0); } break; case 'x': case 'A': shiftup(); break; case 'S': case 'd': shiftdown(); break; case 'l': { rquad += 0.5; } break; case 'r': { rquad -= 0.5; } break; case 'o': { r_quad -= 0.5f; } break; case 's': { r_quad += 0.5f; } break; } #endif }
void TileMap::shift(int dx, int dy) { while (dx < 0) { shiftleft(); dx++; } while (dx > 0) { shiftright(); dx--; } while (dy < 0) { shiftup(); dy++; } while (dy > 0) { shiftdown(); dy--; } }
long dictsize2() { goodness2[1].kdo[0]=1; goodness2[2].kdo[1]=1; goodness2[2].kdo[0]=-1; for(int i=3;i<=m;i++) { //wyliczmy wartosc goodness2[i]: //1.sumujemy wczesniejsze for(int e=1;e<l;e++) if(i-e>0) { add( i-e, i );//(skad,dokad) } //2.wymnarzamy przez k-1 funky( i); } //ostatecznym wynikiem jest suma razy k; for(int e=1;e<l;e++) add(m-e+1,0); shiftup(0); converttobin(); }
void checkshiftup(void) { if(screen_offset<MAX_CLINE && buffer_offset>header_length) shiftup(); }