夢追い人

"It takes a dreamer to make a dream come true."―Vincent Willem van Gogh

とりあえず

Ubuntuでやった分の精進

2840

#include <cstdio>

int main()
{
    int T,H,M;
    scanf("%d",&T);
    for (int i=0; i<T; i++) {
        scanf("%d%*c%d",&H,&M);
        if (M != 0) {
            printf("0\n");
            continue;
        }
        int res = H + 12;
        if (res > 24) res -= 24;
        printf("%d\n",res);
    }
}

2707

#include <cstdio>
int main()
{
    int A, B, C, D;
    while (scanf("%d%d%d%d", &A, &B, &C, &D)) {
        if (A == 0 && B == 0 && C == 0 && D == 0) break;
        if (A > B) {
            int temp = A;
            A = B;
            B = temp;
        }
        if (C > D) {
            int temp = C;
            C = D;
            D = temp;
        }
        if (A <= C && B <= D) {
            printf("100%%\n");
            continue;
        }
        int res;
        if (C * 100 / A >= D * 100 / B) res = D * 100 / B;
        else res = C * 100 / A;
        printf("%d%%\n", res);
    }
}

2665

#include <cstdio>
int main()
{
    int L, M, start, end;
    while (scanf("%d%d", &L, &M)) {
        if (L == 0 && M == 0) break;
        int res = L + 1;
        for (int i=0; i<M; i++) {
            scanf("%d%d", &start, &end);
            res -= end - start + 1;
        }
        printf("%d\n", res);
    }
}

2656

#include <cstdio>
int main() 
{
    int N,school,home;
    while (scanf("%d",&N)&&N!=0) {
        int res=0, time=8;
        for (int i=0; i<N; i++) {
            scanf("%d%d",&school,&home);
            if (school+home>time) {
                time=school+home;
                res=i+1;
            }
        }
        printf("%d\n",res);
    }
}

2636

#include <cstdio>

int main()
{
    int N,K;
    scanf("%d",&N);
    for (int ix=0; ix<N; ix++) {
        scanf("%d",&K);
        int res,temp;
        scanf("%d",&res);
        for (int i=1; i<K; i++) {
            scanf("%d",&temp);
            res+=temp-1;
        }
        printf("%d\n",res);
    }
}
広告を非表示にする