int main(){
  unsigned int T, N, edad[15]; fastread(T);
  for(unsigned int i = 1; i <= T; i++){
    fastread(N);
    for(unsigned int j = 0; j < N; j++)
      fastread(edad[j]);
    std::sort(edad, edad+N);
    printf("Case %d: %d\n", i, edad[N/2]);
  }
  return 0;
}
Example #2
0
main()
{
    int n,t,ans;
    t=fastread();
    while(t--)
    {
        n=fastread();
        ans=n/2+1;
        printf("%d\n",ans);
    }
return 0;
}
main()
{
        int N,i,Q,L,R,j;
        N=fastread();
        //scanf("%d",&N);
        int b[N];
        float C[N],maxm,minm;


        for(i=0; i<N; i++) {
                // scanf("%d",&b[i]);
                b[i]=fastread();
        }

        int *st = constructST(b, N);
        int *m_st=constructST_m(b,N);

        // scanf("%d",&Q);
        Q=fastread();

        for(j=0; j<Q; j++) {
                //scanf("%d",&L);
                //scanf("%d",&R);
                L=fastread();
                R=fastread();


                //call RMQ for fast processing
                minm= RMQ(st, N, L, R);

                for(i=0; i<L; i++) {
                        C[i]= (minm+b[i]);
                }
                for(i=R+1; i<N; i++) {
                        C[i]= (minm+b[i]);
                }

                for(i=L; i<=R; i++) {
                        C[i]= (float)(minm+b[i])/(float)(2);
                }

                maxm=C[0];
                for(i=1; i<N; i++) {
                        if(C[i]>maxm)
                                maxm=C[i];
                }
                printf("%.1f\n",maxm);
        }

        return 0;
}
Example #4
0
File: fast.c Project: zuloo/fast
int main(void)
{
    setlocale(LC_ALL, "en_US.UTF-8");
    int x,y,height,width;
    char *data = inputString(stdin, 1024);

    freopen("/dev/tty", "rw", stdin);

    // enabling ncurses mode
    WINDOW *win = initscr();
    keypad(win, TRUE);
    noecho();
    cbreak();
    curs_set(0);

    // create colorpair for pivot character
    start_color();
    use_default_colors();
    init_pair(1,COLOR_RED,-1);

    // get terminal size
    getmaxyx(win,height,width);
    y=height/2;
    x=width/2;

    // print info
    mvaddstr(1,1,INFO);
    mvaddstr(height-2,1,USAGE);

    // print pivot markers
    attron(COLOR_PAIR(1));
    mvaddstr(y-1,x,MARKTOP);
    mvaddstr(y+1,x,MARKBOT);
    attroff(COLOR_PAIR(1));

    refresh();

    int speed = 350;
    printSpeed(speed);

    fastread(data,x,y,speed);

    free(data);
    endwin();
    return 0;
}