1 条题解

  • 0
    @ 2025-9-10 9:00:40

    C :

    #include <stdio.h>
    #include <math.h>
    
    #define N 11000
    #define G 9.8
    
    double A[N+100];
    
    main() {
        int CASES;
        scanf("%d", &CASES);
        while(CASES--) {
            int i,j;
            double neginf = -1.0/0;
            for(i=1; i<N; i++) {
                A[i] = neginf;
            }
            A[0] = 0;
            int stages;
            scanf("%d", &stages);
            int maxmass = 0;
            for(i=0;i<stages;i++) {
                int ms, mf, th, fc;
                scanf("%d %d %d %d", &ms, &mf, &th, &fc);
                for(j=N; j>=0; j--) {
                    int newm = j + ms;
                    int totm = newm+mf;
                    if(totm > 10000) continue;
                    if(th/totm < G) continue;
                    double time = 1.0*mf/fc;
                    double acc = th*(log(newm+mf) - log(newm))/fc - time*G;
                    acc = acc + A[j];
                    if(acc <= A[newm+mf]) continue;
                    A[newm+mf] = acc;
                }
                maxmass += ms+mf;
            }
            double mx = 0;
            for(i=0; i<N; i++) {
                if(A[i]>mx) mx = A[i];
            }
            //printf("%lf\n", mx);
            printf("%.0lf\n", mx);
        }
    }
    
    
    
    • 1

    信息

    ID
    3650
    时间
    10000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者