夢追い人

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

さっき書いてたの消えた

0539

not lower but upper

#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
    ll d;
    while (scanf("%lld",&d)) {
        if (!d) break;
        int n, m;
        scanf("%d%d",&n,&m);
        ll store[n+1], k;
        store[0]=0;
        for (int i=1; i<n; i++) scanf("%lld",&store[i]);
        sort(store, store+n);
        store[n]=d;
        ll res=0;
        for (int i=0; i<m; i++) {
            scanf("%lld",&k);
            int pos=upper_bound(store, store+n, k)-store;
            res+=min(store[pos]-k, k-store[pos-1]);
        }
        printf("%lld\n",res);
    }
}

0054

#include <cstdio>
int main() {
    int a,b,n;
    while (scanf("%d%d%d",&a,&b,&n)!=EOF) {
        int res=0;
        for (int i=0; i<n; i++) {
            a*=10;
            res+=a/b%10;
            a%=b;
        }
        printf("%d\n",res);
    }
}

0058

why 数IA解 wrong?

#include <cstdio>
int main() {
    double xA,yA,xB,yB,xC,yC,xD,yD;
    while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&xA,&yA,&xB,&yB,&xC,&yC,&xD,&yD)!=EOF) {
        if ((xA-xB)*(xC-xD)+(yA-yB)*(yC-yD)==0) {
            puts("YES");
        } else {
            puts("NO");
        }
    }
}