제출 #464428

#제출 시각아이디문제언어결과실행 시간메모리
464428QuentolosseRack (eJOI19_rack)C++14
40 / 100
102 ms102404 KiB
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main()
{
    int nbEtages, nbCrochets, nbManteauxAPoser;
    cin >> nbEtages >> nbManteauxAPoser;
    vector<int> manteaux;
    nbCrochets = pow (2, nbEtages);
    manteaux.push_back (1);
    manteaux.push_back((nbCrochets / 2) + 1);
    int i = 1, debut = 1;
    while (manteaux.size() < nbManteauxAPoser)
    {
        for (int i2 = 0; i2 < i; i2++)
        {
            manteaux.push_back(manteaux[debut + i2] - (nbCrochets / (i * 4)));
        }
        for (int i2 = 0; i2 < i; i2++)
        {
            manteaux.push_back(manteaux[debut + i2] + (nbCrochets / (i * 4)));
        }
        debut += i;
        i = i * 2;
        
    }
    cout << manteaux[nbManteauxAPoser - 1];
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

rack.cpp: In function 'int main()':
rack.cpp:16:28: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while (manteaux.size() < nbManteauxAPoser)
      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...