Submission #124079

# Submission time Handle Problem Language Result Execution time Memory
124079 2019-07-02T13:41:08 Z HassenAissa Ice Hockey World Championship (CEOI15_bobek) C++14
20 / 100
72 ms 504 KB
#include <bits/stdc++.h>

using namespace std;

int 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);
        tab.push_back(d);
    }
    int res=0;

    for(int i=0; i<(1<<n); i++)
    {
        int total=0;
        int nomb=0;

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

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:22:13: warning: unused variable 'nomb' [-Wunused-variable]
         int nomb=0;
             ^~~~
bobek.cpp:10:9: warning: unused variable 'pluss' [-Wunused-variable]
     int pluss=0;
         ^~~~~
bobek.cpp:11:9: warning: unused variable 'moins' [-Wunused-variable]
     int moins=0;
         ^~~~~
bobek.cpp:8: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:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&d);
         ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -