답안 #124088

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124088 2019-07-02T13:53:56 Z HassenAissa Ice Hockey World Championship (CEOI15_bobek) C++14
10 / 100
86 ms 380 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long unsigned

int32_t main()
{
    int n,m,d;
    scanf("%d%d",&n,&m);
    vector<int> tab;
    int pluss=0;
    int moins=0;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&d);
        if(d<=m)
            tab.push_back(d);
    }
    int res=0;

    for(int i=0; i<(1<<tab.size()); i++)
    {
        int total=0;
        int nomb=0;

        for(int j=0; j<=tab.size(); j++)
        {
            if((i&(1<<j))==0)
            {
                total+=tab[j];
            }
        }
        if(total<=m)
        {
            res++;
        }
    }
    printf("%d\n",res);
    return 0;
}

Compilation message

bobek.cpp: In function 'int32_t main()':
bobek.cpp:9:23: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long unsigned int*' [-Wformat=]
     scanf("%d%d",&n,&m);
                  ~~   ^
bobek.cpp:9:23: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long unsigned int*' [-Wformat=]
bobek.cpp:15:22: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long unsigned int*' [-Wformat=]
         scanf("%d",&d);
                    ~~^
bobek.cpp:21:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<(1<<tab.size()); i++)
                  ~^~~~~~~~~~~~~~~~
bobek.cpp:24:13: warning: unused variable 'nomb' [-Wunused-variable]
         int nomb=0;
             ^~~~
bobek.cpp:38:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long unsigned int' [-Wformat=]
     printf("%d\n",res);
                      ^
bobek.cpp:11:9: warning: unused variable 'pluss' [-Wunused-variable]
     int pluss=0;
         ^~~~~
bobek.cpp:12:9: warning: unused variable 'moins' [-Wunused-variable]
     int moins=0;
         ^~~~~
bobek.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
bobek.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&d);
         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 86 ms 360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -