• 杭电1176


     1 #include<stdio.h>
     2 #include<string.h>
     3 int a[100005][11];
     4 int main()
     5 {
     6     int n,i,j,t,time;
     7     while(~scanf("%d",&n)&&n)
     8     {
     9         time=0;
    10         memset(a,0,sizeof a);
    11         while(n--)
    12         {
    13             scanf("%d%d",&i,&j);
    14             if(j>time)
    15                 time=j;
    16             a[j][i]++;
    17         }
    18         for(i=time-1; i>0; --i)
    19             for(j=0; j<11; ++j)
    20             {
    21                 if(j==0)
    22                     a[i][j] += a[i+1][j]>a[i+1][j+1]?a[i+1][j]:a[i+1][j+1];
    23                 else if(j==10)
    24                     a[i][j] += a[i+1][j]>a[i+1][j-1]?a[i+1][j]:a[i+1][j-1];
    25                 else
    26                 {
    27                     t = a[i+1][j] > a[i+1][j+1] ? a[i+1][j] : a[i+1][j+1];
    28                     a[i][j] += a[i+1][j-1] > t ? a[i+1][j-1] : t;
    29                 }
    30             }
    31         t=a[1][4]>a[1][5]?a[1][4]:a[1][5];
    32         t=a[1][6]>t?a[1][6]:t;
    33         printf("%d
    ",t);
    34     }
    35 }
  • 相关阅读:
    Linux工具-curl
    常用工具-Postman
    HTTP头部信息
    HTTP状态码
    HTTP/HTTP2协议
    HTTP协议
    常用的服务端口
    三次握手,四次挥手和抓包工具
    路由表
    TCP/IP协议详解
  • 原文地址:https://www.cnblogs.com/qq188380780/p/6110352.html
Copyright © 2020-2023  润新知