Submission #1949082


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long kaijou(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}


int main(void){
    int n;
    long long y;
    int a, b;
    scanf("%d %lld", &n, &y);
    for (a = 0; a <= n; a++){
        for (b = 0; b <= n; b++){
            if (10000*a+5000*b+1000*(n-a-b) == y && a+b+(n-a+b) == n){
                printf("%d %d %d\n", a, b, n-a-b);
                return 0;
            }
        }
    }

    printf("-1 -1 -1\n");


    return 0;
}

Submission Info

Submission Time
Task C - Otoshidama
User Morifo
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1683 Byte
Status WA
Exec Time 3 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:68:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %lld", &n, &y);
                             ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 14
WA × 10
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 1 ms 128 KB
a02 AC 1 ms 128 KB
a03 AC 1 ms 128 KB
a04 AC 3 ms 128 KB
b05 AC 1 ms 128 KB
b06 WA 1 ms 128 KB
b07 AC 1 ms 128 KB
b08 AC 1 ms 128 KB
b09 AC 3 ms 128 KB
b10 AC 3 ms 128 KB
b11 AC 3 ms 128 KB
b12 WA 3 ms 128 KB
b13 WA 3 ms 128 KB
b14 WA 3 ms 128 KB
b15 WA 3 ms 128 KB
b16 WA 3 ms 128 KB
b17 WA 3 ms 128 KB
b18 WA 1 ms 128 KB
b19 WA 1 ms 128 KB
b20 WA 3 ms 128 KB
b21 AC 3 ms 128 KB
b22 AC 3 ms 128 KB
b23 AC 3 ms 128 KB
b24 AC 3 ms 128 KB